> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fintoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Test your integration

> Simulate subscription and charges to test your integration.

To confirm that your integration works correctly, simulate subscriptions and charges without moving any money using special values in test mode.

Test special values let you simulate several scenarios:

* Successful subscriptions and charges
* Subscriptions errors due to invalid data or failed user authorization
* Failed charges

Any time you work with a test account, use test [API Keys](/v2023-11-15/docs/home/api-keys) in all API calls.

# Available MFA types

These are the different MFA that we have available within test mode:

* **Security device**: electronic device that banks give their clients to authorize transactions. They generally show a number that changes after some time.
* **Mobile application**: banks offer to authorize transactions through their mobile apps. In this case, the user must authorize the transaction from their *smartphone* and we will detect that the transaction was authorized automatically.
* **SMS**: the bank sends a code (generally a numeric code) to the user's phone so that it can be used to authorize the transaction
* **Coordinate card**: card that banks give their clients with a table with numbers. The user must insert the numbers located at the coordinates asked by the bank. You can read more about coordinate cards [here](https://es.wikipedia.org/wiki/Tarjeta_de_coordenadas).

# Simulate subscriptions

Fintoc provides test special values only for Chile as it's the only country supported by this product. With Subscription test mode, you can test every authorization flow that your user might follow.

## Chile 🇨🇱

In Chile, a subscription has two steps:

1. The user logs in to their bank account.
2. The user authorizes the subscription.

Fintoc provides test special values for each one of those steps.

### Test credentials

You can use the following test credentials to log in to a bank account.

| Username   | Password                                 |
| :--------- | :--------------------------------------- |
| 41614850-3 | <span class="notranslate">jonsnow</span> |
| 40427672-7 | <span class="notranslate">jonsnow</span> |
| 41579263-8 | <span class="notranslate">jonsnow</span> |

### MFA to authorize the subscription

To choose which authorization method to use while in test mode to confirm the subscription, you need to select a specific origin bank account number during the subscription flow. The test mode environment will **always** show the same accounts.

Here's a list of the test mode bank account numbers and which type of MFA corresponds to all of them, along with the correct code to enter.

| Account number | Type of MFA                  | Correct code         |
| :------------- | :--------------------------- | :------------------- |
| 813990168      | Security device              | `000000`             |
| 422159212      | Mobile Application - Success | `N/A`                |
| 5233137377     | Mobile Application - Failure | `N/A`                |
| 170086177      | SMS                          | `0000`               |
| 746326042      | Coordinate Card              | `['00', '00', '00']` |
|                |                              |                      |

### Test errors

To test error handling for Subscriptions in Test mode, the Sandbox provides deterministic dummy debtor accounts. When you create a subscription and select one of the accounts below, the subscription will fail with the corresponding error code:

<Info>
  * The “account ending in XXXX” refers to the last 4 digits of the debtor account number shown in the Sandbox.
  * These behaviors occur only in Test mode and never charge or create a live mandate.
</Info>

| Error Trigger (choose this debtor account / action)              | Resulting Error Code    | What happens                                                                                                         |
| :--------------------------------------------------------------- | :---------------------- | :------------------------------------------------------------------------------------------------------------------- |
| Debtor account ending in 9999                                    | `internal_error`        | Simulates an unexpected server-side failure. Handle as a generic retryable error.                                    |
| Debtor account ending in 8888                                    | `request_timeout`       | Simulates a network/processing timeout on the request. Your client should implement idempotency and retries.         |
| Debtor account ending in 7777                                    | `authorization_timeout` | Simulates an authorization flow that never completes within the allowed window. Treat as a timeout in the auth step. |
| Any MFA (code/OTP) account using an OTP other than 000000        | `authorization_failed`  | Simulates an incorrect or failed MFA attempt during authorization.                                                   |
| Start an authorization and wait 10 minutes without completing it | `subscription_expired`  | The subscription intent expires automatically. New attempts must start a fresh intent.                               |

# Simulate charges

To simulate a successful or failed charge, you can use the amount attribute:

* Amounts greater than or equal to `500` result in a `succeeded` charge.
* Amounts less than 500 `result` in a `failed` charge.

In test mode, both scenarios have immediate webhook notifications. Before making a test charge, you need to create a test subscription.

## Example - Succeeded

```curl Request theme={null}
curl --request POST \
     --url https://api.fintoc.com/v1/charges \
     --header 'Accept: application/json' \
     --header 'Authorization: sk_test_9c8dr3ryBTx1VcJzuDgpm4H' \
     --header 'Content-Type: application/json' \
     --data '
{
     "currency": "clp",
     "subscription_id": "sub_123ad123",
     "amount": 500
}
'
```

```json Response theme={null}
{
 "id": "ch_e6dGMaB5UVy2QV3j",
 "failure_code": null,
 "created_at": "2022-07-15T19:09:51Z",
 "object": "charge",
 "status": "pending",
 "amount": 509,
 "currency": "CLP",
 "metadata": {},
 "subscription_id": "sub_gJYEapRyUg07yvz3"
}
```

## Example - Failed

```curl Request theme={null}
curl --request POST \
     --url https://api.fintoc.com/v1/charges \
     --header 'Accept: application/json' \
     --header 'Authorization: sk_test_9c8dr3ryBTx1VcJzuDgpm4H' \
     --header 'Content-Type: application/json' \
     --data '
{
     "currency": "clp",
     "subscription_id": "sub_123ad123",
     "amount": 499
}
'
```

```json Response theme={null}
{
 "id": "ch_e6dGMaB5UVy2QV3j",
 "failure_code": null,
 "created_at": "2022-07-15T19:09:51Z",
 "object": "charge",
 "status": "pending",
 "amount": 50,
 "currency": "CLP",
 "metadata": {},
 "subscription_id": "sub_gJYEapRyUg07yvz3"
}
```

# Test webhooks

To test webhooks, you have two options:

1. Perform actions in test mode that send legitimate events to your endpoint. For instance, to trigger the `charge.succeeded` event, you can use a test value that produces a successful charge.
2. [Trigger test events from the Dashboard](/v2023-11-15/docs/resources/webhooks-walkthrough/webhooks-testing)
