> ## 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.

# Accept a payment

> Accept one-time payments in CLP or MXN through a Fintoc-hosted Checkout Session, from creating the session on your backend to redirecting the customer.

Build a payment flow that collects one-time payments in CLP or MXN through a Fintoc-hosted checkout page.

To accept payments with Fintoc, you complete three steps:

1. On your backend, create a `Checkout Session` using your [Secret Key](https://docs.fintoc.com/guides/home/api-keys.md)
2. Redirect your customer to complete the payment on the Fintoc-hosted checkout page
3. Handle post-payment events

The following diagram shows how Fintoc interacts with both your backend and your frontend:

![](https://mintcdn.com/fintoc-49b8bee8/YQmOnq8Zegydl6oL/images/40e0b1888c86590031351e94422f1d5e23207fcb2f795a93eb76cbb6c780a9eb-accept-payment-diagram.png?fit=max\&auto=format\&n=YQmOnq8Zegydl6oL\&q=85\&s=653e7ae98608d0462ec14d67546c6ca5)

## Optional: install the backend SDK

> [tab] Python
>
> If you’re using Python, you can install our [Python SDK](https://github.com/fintoc-com/fintoc-python) to make it easier to interact with our API. The SDK automatically handles pagination, lets you easily verify Fintoc's webhooks, and offers many other helpful features.
>
> ```bash theme={null}
> pip install fintoc
> ```

> [tab] Node
>
> If you’re using Node, you can install our [Node SDK](https://github.com/fintoc-com/fintoc-node) to make it easier to interact with our API. The SDK automatically handles pagination, lets you easily verify Fintoc's webhooks, and offers many other helpful features.
>
> ```bash theme={null}
> npm install fintoc
> ```

## Create a session

The [Checkout Session](https://docs.fintoc.com/api/payments-api/checkout-sessions/checkout-session-object.md) object represents your intent to collect a payment from a customer and tracks state changes throughout the payment process.

Using your [Secret Key](https://docs.fintoc.com/guides/home/api-keys.md), create a `Checkout Session` from your backend with the required parameters: `amount`, `currency`, `success_url`, and `cancel_url`, like the example below:

**Server**

```bash theme={null}
curl --request POST "https://api.fintoc.com/v2/checkout_sessions" \
  --header "Authorization: YOUR_TEST_SECRET_API_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '{
    "amount": 350000,
    "currency": "CLP",
    "success_url": "https://merchant.com/success",
    "cancel_url": "https://merchant.com/cancel",
    "customer_data": {
      "tax_id": {
        "type": "cl_rut",
        "value": "41.579.263-8"
      },
      "name": "Felipe Castro",
      "email": "jon@snow.com",
      "metadata": {}
    },
    "metadata": {
      "order": "987654321"
    }
  }'
```

```javascript Node theme={null}
const { Fintoc } = require('fintoc');

const fintoc = new Fintoc('YOUR_TEST_SECRET_API_KEY');

const checkoutSession = await fintoc.v2.checkoutSessions.create({
  amount: 350000,
  currency: 'CLP',
  success_url: 'https://merchant.com/success',
  cancel_url: 'https://merchant.com/cancel',
  customer_data: {
    tax_id: {
      type: 'cl_rut',
      value: '41.579.263-8'
    },
    name: 'Felipe Castro',
    email: 'jon@snow.com',
    metadata: {}
  },
  metadata: {
    order: '987654321'
  }
});
```

```python theme={null}
from fintoc import Fintoc

client = Fintoc('YOUR_TEST_SECRET_API_KEY')

checkout_session = client.v2.checkout_sessions.create(
    amount=350000,
    currency='CLP',
    success_url='https://merchant.com/success',
    cancel_url='https://merchant.com/cancel',
    customer_data={
        'tax_id': {
            'type': 'cl_rut',
            'value': '41.579.263-8'
        },
        'name': 'Felipe Castro',
        'email': 'jon@snow.com',
        'metadata': {}
    },
    metadata={
        'order': '987654321'
    }
)
```

Fintoc responds with the created `Checkout Session` object, including the `redirect_url` you use to send the customer to the payment:

```json theme={null}
{
  "id": "cs_li5531onlFDi235",
  "object": "checkout_session",
  "mode": "test",
  "status": "created",
  "amount": 350000,
  "currency": "CLP",
  "created_at": "2024-06-04T15:32:46.721Z",
  "success_url": "https://merchant.com/success",
  "cancel_url": "https://merchant.com/cancel",
  "redirect_url": "https://pay.fintoc.com/checkout/cs_li5531onlFDi235",
  "metadata": {
    "order": "987654321"
  },
  "customer": {
    "id": "cus_3B2bODrQFje7ZVkT69xyaTSDwXQ",
    "object": "customer",
    "name": "Felipe Castro",
    "email": "jon@snow.com",
    "metadata": {},
    "tax_id": {
      "type": "cl_rut",
      "value": "111111111"
    }
  }
}
```

| Parameter | Example | Description |
| - | - | - |
| `amount` | 350000 | **Required.** A positive integer representing the amount to charge, in the smallest currency unit. CLP has no minor unit, so `350000` means CLP 350000. MXN uses centavos, so `350000` means MXN 3500.00. [Read more about currencies](https://docs.fintoc.com/guides/home/currencies.md). |
| `currency` | `CLP` or `MXN` | **Required.** Three-letter ISO 4217 currency code. One of `CLP` or `MXN`. See the [supported currencies](https://docs.fintoc.com/guides/home/currencies.md) for the full list. |
| `success_url` | `https://merchant.com/success` | **Required.** URL Fintoc redirects the customer to after a successful payment. |
| `cancel_url` | `https://merchant.com/cancel` | **Required.** URL Fintoc redirects the customer to if they cancel the payment and return to your website. |
| `metadata` | `{"order": "987654321"}` | Set of key-value pairs you can attach to an object, useful for storing additional information in a structured format. |

### Business profile (optional)

> [!NOTE]
>
> **Send the Business Profile object if you are processing payments for a submerchant**
>
> You can also add the `business_profile` object when creating a session to customize the name displayed as the "Recipient" on the payment flow.
>
> [Read here to learn more](https://docs.fintoc.com/api/payments-api/checkout-sessions/checkout-sessions-create.md).

### Include customer data (optional)

When creating a `Checkout Session`, you can include customer information by sending a `customer_data` object (or `customer` with the `id` of an existing `Customer`). This information allows Fintoc to display only the payment methods available for that specific customer. For example, Fintoc hides a bank when the amount exceeds its [transaction limit](https://docs.fintoc.com/guides/payments/overview-payment-initiation/transaction-limits.md).

| Attribute | Type | Description |
| - | - | - |
| `tax_id` | `object` | **Required if no `email`.** Object that identifies the customer at a fiscal or regulatory level. It includes a `type` field indicating the format or country-specific identifier, for example, `cl_rut` for a Chilean tax ID (RUT), `mx_rfc` for a Mexican tax ID (RFC), or `custom` for any other identifier. It also includes a `value` field that contains the tax identifier as a string. For `custom`, send any non-empty value. Fintoc removes leading and trailing spaces and does not validate its format. If a `Customer` with the same `tax_id` already exists, the request returns a `409 Conflict` error. To reuse an existing `Customer`, send its `id` in `customer` instead of `customer_data`. |
| `name` | `string` | Full name of the customer. |
| `email` | `string` | **Required if no `tax_id`.** Email address of the customer. |
| `metadata` | `object` | Custom data that stores additional information about the customer, such as internal IDs, CRM references, or tags. |

> [!NOTE]
>
> **Bank specific payment flows for business accounts and high amounts**
>
> In Chile, some `bank_transfer` payments require banks with special payment flows: Banco Estado, Banco de Chile, and Banco Santander. Fintoc limits the session to these banks when the payment exceeds the [transaction limits](https://docs.fintoc.com/guides/payments/overview-payment-initiation/transaction-limits.md) or the `customer` has a `tax_id.value` of a business instead of a natural person. You can test this flow with the [alternative payment method test guide](https://docs.fintoc.com/guides/payments/alternative-payment-methods/alternative-payment-method-test-your-integration.md).

### Include a list of items (optional)

When creating a `Checkout Session`, you can also send the `line_items`, including information about the items of the session. This enables Fintoc to display this information on the checkout page and show only the payment methods available for specific products.

Each item should have:

| Attribute | Type | Description |
| :- | :- | :- |
| `quantity` | `integer` | **Required.** Number of units of this item being purchased. |
| `price_data` | `object` | **Required.** Object with the price of the item and its product details. |

#### The `price_data` object

| Attribute | Type | Description |
| :- | :- | :- |
| `product_data` | `object` | **Required.** Object with information about the product, such as its name and image. |
| `currency` | `string` | **Required.** Three-letter ISO 4217 currency code (for example, `CLP`, `MXN`). |
| `unit_amount` | `integer` | **Required.** Price per unit of the item, in the smallest currency unit. CLP has no minor unit, so `350000` means CLP 350000. |

#### The `product_data` object

The `price_data` object contains a `product_data` object with product information:

| Attribute | Type | Description |
| :- | :- | :- |
| `name` | `string` | **Required.** Name of the product or service being purchased. |
| `image_url` | `string` | Image URL for the product. Must be an HTTPS URL. Recommended aspect ratio: 9:4. |

The example below creates a `Checkout Session` with a single line item:

**Server**

```bash theme={null}
curl --request POST "https://api.fintoc.com/v2/checkout_sessions" \
  --header "Authorization: YOUR_TEST_SECRET_API_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '{
    "amount": 350000,
    "currency": "CLP",
    "success_url": "https://merchant.com/success",
    "cancel_url": "https://merchant.com/cancel",
    "line_items": [
      {
        "quantity": 1,
        "price_data": {
          "currency": "CLP",
          "unit_amount": 350000,
          "product_data": {
            "name": "Annual subscription",
            "image_url": "https://merchant.com/images/annual-subscription.png"
          }
        }
      }
    ]
  }'
```

```javascript Node theme={null}
const { Fintoc } = require('fintoc');

const fintoc = new Fintoc('YOUR_TEST_SECRET_API_KEY');

const checkoutSession = await fintoc.v2.checkoutSessions.create({
  amount: 350000,
  currency: 'CLP',
  success_url: 'https://merchant.com/success',
  cancel_url: 'https://merchant.com/cancel',
  line_items: [
    {
      quantity: 1,
      price_data: {
        currency: 'CLP',
        unit_amount: 350000,
        product_data: {
          name: 'Annual subscription',
          image_url: 'https://merchant.com/images/annual-subscription.png'
        }
      }
    }
  ]
});
```

```python theme={null}
from fintoc import Fintoc

client = Fintoc('YOUR_TEST_SECRET_API_KEY')

checkout_session = client.v2.checkout_sessions.create(
    amount=350000,
    currency='CLP',
    success_url='https://merchant.com/success',
    cancel_url='https://merchant.com/cancel',
    line_items=[
        {
            'quantity': 1,
            'price_data': {
                'currency': 'CLP',
                'unit_amount': 350000,
                'product_data': {
                    'name': 'Annual subscription',
                    'image_url': 'https://merchant.com/images/annual-subscription.png'
                }
            }
        }
    ]
)
```

Fintoc responds with the created `Checkout Session` object. Each item in `line_items` includes a `price` with the `product` details you sent:

```json theme={null}
{
  "id": "cs_li5531onlFDi235",
  "object": "checkout_session",
  "mode": "test",
  "status": "created",
  "amount": 350000,
  "currency": "CLP",
  "created_at": "2024-06-04T15:32:46.721Z",
  "success_url": "https://merchant.com/success",
  "cancel_url": "https://merchant.com/cancel",
  "redirect_url": "https://pay.fintoc.com/checkout/cs_li5531onlFDi235",
  "metadata": {},
  "line_items": [
    {
      "quantity": 1,
      "price": {
        "currency": "CLP",
        "unit_amount": 350000,
        "product": {
          "description": null,
          "image_url": "https://merchant.com/images/annual-subscription.png",
          "metadata": {},
          "name": "Annual subscription"
        },
        "recurring": null
      }
    }
  ]
}
```

### Pre-select a payment method (optional)

You can create a `Checkout Session` without specifying payment methods. In this case, customers can select from all available options on the Fintoc-hosted checkout page, based on the session parameters (`amount`, `customer`, `currency`) and the payment methods you have enabled in Fintoc.

Alternatively, you can explicitly define the payment method type(s) for the session. For example, the request below sets the `bank_transfer` method and uses `payment_method_options` to pre-select the institution `cl_banco_estado` for the customer. In this scenario, the payment flow presented to the customer is limited to this specific method and bank.

**Server**

```bash theme={null}
curl --request POST "https://api.fintoc.com/v2/checkout_sessions" \
    --header "Authorization: YOUR_TEST_SECRET_API_KEY" \
    --header "Content-Type: application/json" \
    --data-raw '{
      "amount": 350000,
      "currency": "CLP",
      "success_url": "https://merchant.com/success",
      "cancel_url": "https://merchant.com/cancel",
      "payment_method_types": ["bank_transfer"],
      "payment_method_options": {
        "bank_transfer": {
          "sender_account": {
            "institution_id": {
              "value": "cl_banco_estado"
            }
          }
        }
      },
      "customer_data": {
        "tax_id": {
          "type": "cl_rut",
          "value": "41.579.263-8"
        },
        "name": "Felipe Castro",
        "email": "jon@snow.com",
        "metadata": {}
      }
    }'
```

```javascript Node theme={null}
const { Fintoc } = require('fintoc');

const fintoc = new Fintoc('YOUR_TEST_SECRET_API_KEY');

const checkoutSession = await fintoc.v2.checkoutSessions.create({
  amount: 350000,
  currency: 'CLP',
  success_url: 'https://merchant.com/success',
  cancel_url: 'https://merchant.com/cancel',
  payment_method_types: ['bank_transfer'],
  payment_method_options: {
    bank_transfer: {
      sender_account: {
        institution_id: {
          value: 'cl_banco_estado'
        }
      }
    }
  },
  customer_data: {
    tax_id: {
      type: 'cl_rut',
      value: '41.579.263-8'
    },
    name: 'Felipe Castro',
    email: 'jon@snow.com',
    metadata: {}
  }
});
```

```python theme={null}
from fintoc import Fintoc

client = Fintoc('YOUR_TEST_SECRET_API_KEY')

checkout_session = client.v2.checkout_sessions.create(
    amount=350000,
    currency='CLP',
    success_url='https://merchant.com/success',
    cancel_url='https://merchant.com/cancel',
    payment_method_types=['bank_transfer'],
    payment_method_options={
        'bank_transfer': {
            'sender_account': {
                'institution_id': {
                    'value': 'cl_banco_estado'
                }
            }
        }
    },
    customer_data={
        'tax_id': {
            'type': 'cl_rut',
            'value': '41.579.263-8'
        },
        'name': 'Felipe Castro',
        'email': 'jon@snow.com',
        'metadata': {}
    }
)
```

| Attribute | Type | Description |
| :- | :- | :- |
| `payment_method_types` | `array of strings` | List of payment method types available for the session. One or more of `bank_transfer`, `card`, `cash`. `cash` is available only in `MXN` sessions. |
| `payment_method_options` | `object` | Set of settings for each available payment method. |

With `card`, the checkout also shows Apple Pay on devices that support it, in both `live` and `test` mode.

Fintoc responds with the created `Checkout Session` object, echoing the pre-selected method and institution:

```json theme={null}
{
  "id": "cs_li5531onlFDi235",
  "object": "checkout_session",
  "mode": "test",
  "status": "created",
  "amount": 350000,
  "currency": "CLP",
  "created_at": "2024-06-04T15:32:46.721Z",
  "success_url": "https://merchant.com/success",
  "cancel_url": "https://merchant.com/cancel",
  "redirect_url": "https://pay.fintoc.com/checkout/cs_li5531onlFDi235",
  "metadata": {},
  "payment_method_types": [
    "bank_transfer"
  ],
  "payment_method_options": {
    "bank_transfer": {
      "sender_account": {
        "institution_id": {
          "value": "cl_banco_estado"
        }
      }
    }
  },
  "customer": {
    "id": "cus_3B2bODrQFje7ZVkT69xyaTSDwXQ",
    "object": "customer",
    "name": "Felipe Castro",
    "email": "jon@snow.com",
    "metadata": {},
    "tax_id": {
      "type": "cl_rut",
      "value": "111111111"
    }
  }
}
```

![](https://mintcdn.com/fintoc-49b8bee8/YQmOnq8Zegydl6oL/images/14f9be8089f64e7247ce874ee2bdca674fa9ccc1f9b479c2e499b6e31f592b35-payment-methods-pre-selected.png?fit=max\&auto=format\&n=YQmOnq8Zegydl6oL\&q=85\&s=13740451d33acbeb815bccfd23fac655)

**Left**: Default view showing all available methods in Chile (bank transfer and cards) when no `payment_method_types` parameter is set. **Center**: Pre-selected `bank_transfer` flow for Banco Estado, displaying the institution-specific payment form directly. **Right**: Pre-selected `card` flow.

> [!NOTE]
>
> **Using your own Checkout Page**
>
> When you have your own checkout page, you should set the `payment_method_types` to redirect customers to the Fintoc-hosted checkout after they've already selected their preferred payment method.
>
> This skips Fintoc's payment method selection screen and directs customers straight to the specific payment flow, instead of letting Fintoc manage the full checkout experience.

#### Offer cash in MXN sessions

In `MXN` sessions, you can offer `cash` on its own or combine it with `card` and `bank_transfer`. Your customer picks how to pay on the Fintoc-hosted checkout page. You can't combine `cash` with `installments`. For example, the following request lets your customer pay with a card or in cash:

**Server**

```bash theme={null}
curl --request POST "https://api.fintoc.com/v2/checkout_sessions" \
    --header "Authorization: YOUR_TEST_SECRET_API_KEY" \
    --header "Content-Type: application/json" \
    --data-raw '{
      "amount": 250000,
      "currency": "MXN",
      "success_url": "https://merchant.com/success",
      "cancel_url": "https://merchant.com/cancel",
      "payment_method_types": ["card", "cash"]
    }'
```

Fintoc responds with the session object, including `cash` in `payment_method_types`:

```json theme={null}
{
  "id": "cs_li5531onlFDi235",
  "object": "checkout_session",
  "mode": "test",
  "status": "created",
  "amount": 250000,
  "currency": "MXN",
  "created_at": "2024-06-04T15:32:46.721Z",
  "success_url": "https://merchant.com/success",
  "cancel_url": "https://merchant.com/cancel",
  "redirect_url": "https://pay.fintoc.com/checkout/cs_li5531onlFDi235",
  "metadata": {},
  "payment_method_types": [
    "card",
    "cash"
  ]
}
```

If a card or bank transfer payment fails and `cash` is available in the session, your customer can retry the payment in cash. See [Accept cash payments in Mexico](https://docs.fintoc.com/guides/payments/cash-payment-direct-api.md) for how cash payments work.

### Accept only some cards (optional)

To accept only cards from some banks, send their bank identification numbers (BINs) in `payment_method_options.card.bins`. A BIN is the first 6 or 8 digits of a card number, and it identifies the bank that issued the card. For example, use `bins` to offer a discount that a bank funds for its own cards.

The request below creates a session that accepts only cards that start with `411111` or `455555`:

**Server**

```bash theme={null}
curl --request POST "https://api.fintoc.com/v2/checkout_sessions" \
    --header "Authorization: YOUR_TEST_SECRET_API_KEY" \
    --header "Content-Type: application/json" \
    --data-raw '{
      "amount": 90000,
      "currency": "CLP",
      "success_url": "https://merchant.com/success",
      "cancel_url": "https://merchant.com/cancel",
      "payment_method_types": ["card"],
      "payment_method_options": {
        "card": {
          "bins": ["411111", "455555"]
        }
      }
    }'
```

```javascript Node theme={null}
const { Fintoc } = require('fintoc');

const fintoc = new Fintoc('YOUR_TEST_SECRET_API_KEY');

const checkoutSession = await fintoc.v2.checkoutSessions.create({
  amount: 90000,
  currency: 'CLP',
  success_url: 'https://merchant.com/success',
  cancel_url: 'https://merchant.com/cancel',
  payment_method_types: ['card'],
  payment_method_options: {
    card: {
      bins: ['411111', '455555']
    }
  }
});
```

```python theme={null}
from fintoc import Fintoc

client = Fintoc('YOUR_TEST_SECRET_API_KEY')

checkout_session = client.v2.checkout_sessions.create(
    amount=90000,
    currency='CLP',
    success_url='https://merchant.com/success',
    cancel_url='https://merchant.com/cancel',
    payment_method_types=['card'],
    payment_method_options={
        'card': {
            'bins': ['411111', '455555']
        }
    }
)
```

Fintoc responds with the session object, including `bins` in `payment_method_options`:

```json theme={null}
{
  "id": "cs_li5531onlFDi235",
  "object": "checkout_session",
  "mode": "test",
  "status": "created",
  "amount": 90000,
  "currency": "CLP",
  "created_at": "2024-06-04T15:32:46.721Z",
  "success_url": "https://merchant.com/success",
  "cancel_url": "https://merchant.com/cancel",
  "redirect_url": "https://pay.fintoc.com/checkout/cs_li5531onlFDi235",
  "metadata": {},
  "payment_method_types": [
    "card"
  ],
  "payment_method_options": {
    "card": {
      "bins": [
        "411111",
        "455555"
      ]
    }
  }
}
```

The `bins` restriction follows these rules:

* `bins` is a non-empty array of strings, each with 6 or 8 digits. If you send an empty array, a BIN with a different length, or a BIN with non-digit characters, Fintoc returns `400 Bad Request` with the `invalid_payment_method_options` error.
* `bins` applies only to `payment` flow sessions.
* `bins` restricts only cards. If the session also offers another payment method, such as `bank_transfer`, your customer can still pay with that method.
* Fintoc checks the card when your customer enters it, not when you create the session. If the card doesn't start with one of the BINs, the checkout rejects the card before charging it and asks your customer for another card.
* A session with `bins` doesn't offer Apple Pay, Google Pay, saved cards, or Hites cards (`hites` in `payment_method_options.card.types`). In an [Express Checkout](https://docs.fintoc.com/guides/payments/accept-a-payment/accept-a-one-click-payment-with-apple-pay.md) session, Fintoc rejects the Apple Pay payment, so don't send `bins` there.

To test the restriction in `test` mode, create the session above and pay with the Chilean [test card](https://docs.fintoc.com/guides/payments/payment-initiation-test-your-integration.md#card-payments) `4111111111111111`. The checkout rejects any test card that starts with other digits, such as `4456524869770255`.

#### Offer a discount for some cards

You can't change the `amount` of a Checkout Session after you create it. To offer a discount for the cards of one bank, show your customer two ways to pay. Tell your customer which cards get the discount, because the checkout doesn't show your promotion. When your customer chooses a way to pay, create the corresponding session:

* **Discounted payment:** a session with the discounted `amount`, `payment_method_types` set to `["card"]`, and the BINs the bank gives you in `payment_method_options.card.bins`.
* **Regular payment:** a session with the full `amount` and without `bins`.

Set only `card` in the discounted session. Otherwise, your customer can pay the discounted `amount` with another payment method. Set the `cancel_url` of the discounted session to the page where your customer chooses how to pay. A customer without a card from that bank can then go back and pay the full `amount`. When your customer comes back through `cancel_url`, [expire](https://docs.fintoc.com/api/payments-api/checkout-sessions/checkout-sessions-expire.md) the discounted session so your customer can't pay it later.

### Response when creating a Checkout Session

After you make the request to create the [Checkout Session](https://docs.fintoc.com/api/payments-api/checkout-sessions/checkout-session-object.md), Fintoc responds with the session object:

```json theme={null}
{
  "id": "cs_li5531onlFDi235",
  "object": "checkout_session",
  "mode": "test",
  "status": "created",
  "amount": 350000,
  "currency": "CLP",
  "created_at": "2024-06-04T15:32:46.721Z",
  "success_url": "https://merchant.com/success",
  "cancel_url": "https://merchant.com/cancel",
  "redirect_url": "https://pay.fintoc.com/checkout/cs_li5531onlFDi235",
  "metadata": {},
  "customer": {
    "id": "cus_3B2bODrQFje7ZVkT69xyaTSDwXQ",
    "object": "customer",
    "name": "Felipe Castro",
    "email": "jon@snow.com",
    "metadata": {},
    "tax_id": {
      "type": "cl_rut",
      "value": "111111111"
    }
  }
}
```

The response includes the `redirect_url` attribute. In the following step, you'll use this attribute to redirect the customer to complete the payment.

## Redirect the customer to complete the payment

Next, redirect customers to the Fintoc-hosted checkout page.

After a successful payment, Fintoc shows a success screen with a `Volver a {merchant}` button. By default, Fintoc redirects the customer to the `success_url` only when they click that button. If the customer cancels, Fintoc redirects them to the `cancel_url`.

> [!NOTE]
>
> Customers who close the tab on the success screen never reach your `success_url`. To redirect customers automatically, ask [Fintoc support](mailto:soporte@fintoc.com) to enable automatic redirect for your organization. With automatic redirect enabled, the success screen shows a countdown of at least 3 seconds and then redirects the customer to the `success_url`. The setting applies to one-time payments and subscriptions, in both `live` and `test` mode.

The Fintoc-hosted checkout does not support iframe integrations. Do not load the `redirect_url` in an `iframe`; redirect the full browser page instead.

**Client**

```javascript theme={null}
window.location.assign(REDIRECT_URL_FROM_YOUR_BACKEND);
```

To keep customers on your site instead, render the same Checkout Session with the embedded Widget. Pass the session's `session_token` as the Widget's `sessionToken` option. See [Integrate the Widget on the web](https://docs.fintoc.com/guides/resources/widget/web-integration.md) or [WebView integration](https://docs.fintoc.com/guides/resources/widget/webview.md) for mobile apps.

You don't create a Payment Intent for a Checkout Session. Fintoc creates the Payment Intent automatically when your customer starts a payment attempt. The session's `payment_resource` field exposes the Payment Intent and stays `null` until then.

## Handle post-payment events

Once a `Checkout Session` finishes, you handle the payment result in your frontend and complete the payment in your backend. On your backend, use the events that Fintoc sends through webhooks.

### Complete the payment on your backend

Fintoc sends a `checkout_session.finished` and a `payment_intent.succeeded` event when the session completes and the payment is successful. Follow the [webhook guide](https://docs.fintoc.com/guides/resources/webhooks-walkthrough) to receive these events and run actions, such as sending an order confirmation email to your customer, logging the sale in a database, or starting a shipping workflow.

The `checkout_session.finished` event includes information about the session and the `payment_intent`:

```json theme={null}
{
  "id": "evt_a4xK32BanKWYn",
  "object": "event",
  "type": "checkout_session.finished",
  "data": {
    "id": "cs_li5531onlFDi235",
    "mode": "test",
    "amount": 350000,
    "object": "checkout_session",
    "status": "finished",
    "flow": "payment",
    "currency": "CLP",
    "metadata": {},
    "cancel_url": "https://merchant.com/cancel",
    "created_at": "2026-01-13T18:48:25Z",
    "expires_at": "2026-01-14T18:48:25Z",
    "success_url": "https://merchant.com/success",
    "redirect_url": "https://pay.fintoc.com/checkout/cs_li5531onlFDi235",
    "session_token": null,
    "customer_email": null,
    "customer": {
      "id": "cus_3B2bODrQFje7ZVkT69xyaTSDwXQ",
      "object": "customer",
      "name": "Felipe Castro",
      "email": "jon@snow.com",
      "metadata": {},
      "tax_id": {
        "type": "cl_rut",
        "value": "111111111"
      }
    },
    "payment_method_types": [
      "bank_transfer"
    ],
    "business_profile": {},
    "payment_resource": {
      "payment_intent": {
        "id": "pi_38DNJo3rbvGUzKFvCGZ6dxR1Kxx",
        "mode": "test",
        "amount": 350000,
        "object": "payment_intent",
        "status": "succeeded",
        "currency": "CLP",
        "metadata": {},
        "created_at": "2026-01-13T18:48:31Z",
        "expires_at": "2026-01-14T18:48:25Z",
        "error_reason": null,
        "payment_type": "bank_transfer",
        "reference_id": null,
        "widget_token": null,
        "customer_email": null,
        "sender_account": {
          "type": "checking_account",
          "number": "000000000",
          "holder_id": "111111111",
          "institution_id": "cl_banco_falabella"
        },
        "business_profile": {},
        "transaction_date": null,
        "recipient_account": null,
        "payment_type_options": {}
      }
    },
    "payment_method_options": {}
  }
}

```

Fintoc emits these events across the payment lifecycle, including the failure and pending paths. Handle each one:

| Event | Description | Action |
| - | - | - |
| `checkout_session.finished` | Sent when a `Checkout Session` reaches a final state. The associated payment may still be pending, for example `requires_action`. | Complete the order based on `data.payment_resource.payment_intent.status`. If the status is `requires_action`, read `next_action` and tell your customer what they need to do. |
| `checkout_session.expired` | Sent when a `Checkout Session` expires. | Offer the customer another attempt to pay. |
| `payment_intent.succeeded` | Sent when the payment related to a `Checkout Session` succeeds. | Confirm the customer's order. |
| `payment_intent.failed` | Sent when the payment related to a `Checkout Session` fails. | Offer the customer another attempt to pay. |

> [!NOTE]
>
> **Handling async payments after the `Checkout Session` ends**
>
> In some cases, the `Checkout Session` may finish with a payment that does not yet have a final status, such as `requires_action`. This can happen, for example, when a bank transfer from a business account requires approval from more than one representative.
>
> Fintoc does not send a separate event for this status. You receive `checkout_session.finished` with `data.payment_resource.payment_intent.status` set to `requires_action`, so inform the customer that the payment is pending approval. When the payment reaches its final status, Fintoc sends `payment_intent.succeeded` or `payment_intent.failed`. Notify the customer of the final status when you receive it.

## 3-D Secure for card payments

3-D Secure (3DS) is an extra authentication step where the card issuer verifies that your customer owns the card. The issuer either approves the payment without asking your customer for anything (frictionless) or asks your customer to complete a challenge, such as a code sent by the bank.

Fintoc decides whether each card payment goes through 3DS based on its risk. Fintoc considers signals such as the payment amount, the country where the card was issued, and the customer's payment history. For example, Fintoc can use the payment amount or a card issued outside your country as signals to decide whether to require 3DS. Because of this, some of your card payments go through 3DS and others don't.

Some payment types always follow the same rule:

| Payment type | 3DS |
| :- | :- |
| [Payment with a saved card](https://docs.fintoc.com/guides/payments/accept-a-payment/accept-a-one-click-payment-with-a-saved-card) | Always |
| [Apple Pay](https://docs.fintoc.com/guides/payments/accept-a-payment/accept-a-one-click-payment-with-apple-pay.md) | Never |

### Change the 3DS rules for your organization

Fintoc configures the 3DS rules for each organization. If you receive disputes for fraudulent payments, you can ask Fintoc support at [soporte@fintoc.com](mailto:soporte@fintoc.com) to change your rules, for example, to require 3DS on every card payment regardless of the amount. This change doesn't cover Apple Pay payments, which never go through 3DS.

Changing the 3DS rules can reduce fraudulent payments and disputes. The change can also add an authentication step for customers whose payments would not otherwise use 3DS, so some customers might not complete the payment. Balance both effects based on the fraud you see in your business.

## Customer email notifications

Fintoc emails your customer a payment receipt after a successful payment. Fintoc sends the receipt when either of these is true:

* You set `customer_email` when you create the `Checkout Session`.
* Your customer enters an email address on the success screen of the payment flow and requests the receipt.

If you set `customer_email`, Fintoc also uses it to notify your customer about [refunds](https://docs.fintoc.com/guides/payments/fintoc-collect-payments/payment-initiation-refunds.md#refund-notifications).

To stop Fintoc from sending payment receipts automatically, leave out `customer_email` when you create the `Checkout Session`. Your customer can still request the receipt from the success screen.

Without `customer_email`, Fintoc also doesn't send refund notifications. To turn off all payment receipts for your account, including receipts customers request from the success screen, contact Fintoc support at [soporte@fintoc.com](mailto:soporte@fintoc.com).

## Test your integration

Using your [test mode API Secret Key](https://docs.fintoc.com/guides/resources/test-mode.md), you can create payments that simulate successful and failed outcomes without moving any money.

This lets you validate your full payment flow end-to-end:

* Your backend API requests (creating sessions and handling responses)
* The redirect flow from your frontend to the `redirect_url` and back to the `success_url` or `cancel_url` after the payment
* The webhooks for post-payment events

A successful test session reaches `status` `finished` and triggers the `checkout_session.finished` and `payment_intent.succeeded` webhooks; a failed one triggers `payment_intent.failed`. To trigger specific scenarios, use the **test credentials** and special test values described in our [testing guide](https://docs.fintoc.com/guides/payments/payment-initiation-test-your-integration.md).
