> ## 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 one-click payment with a saved card (Chile only)

> Let customers pay in Checkout with a card they already saved, by choosing it themselves or with your business preselecting it, then confirming with 3-D Secure.

This guide applies only to businesses in Chile and payments in `CLP`. When a customer already saved a card with Fintoc, they can pay with it in Checkout without typing the card details again. Your customer confirms the payment and authenticates it with 3-D Secure (3DS), and Fintoc charges the card.

You can offer a saved card in two ways:

1. **Your customer chooses the card:** create a Checkout Session with the `customer` and `card` in `payment_method_types`. Checkout lists the customer's saved cards.
2. **You preselect the card:** create a Checkout Session with the `customer` and the saved card's `id` in `payment_method`. Checkout opens directly on the confirmation of that card.

In both cases, your customer confirms the payment in Checkout. Creating the Checkout Session never charges the card.

## Before you begin

* Your organization is based in Chile.
* Your customer has a `Customer` with a saved `card` payment method. To save one, create a Checkout Session with `flow` set to `setup`, as described in [Set up a payment method for future charges](https://docs.fintoc.com/guides/payments/accept-recurring-payments/setup-a-payment-method-for-future-charges.md).
* In `test` mode, saved card payments are available to every organization in Chile. In `live` mode, Fintoc must enable card payments and saved card payments for your organization. Contact Fintoc to request access.

Checkout offers a saved card only when the card is active and the session allows its kind (`credit` or `debit`). If you restrict card kinds with `payment_method_options.card.kinds`, Checkout hides saved cards of any kind you excluded.

## Option 1: Let your customer choose a saved card

Create a Checkout Session with `flow` set to `payment`, the `customer` ID, and `card` in `payment_method_types`.

**Server**

```bash theme={null}
curl --request POST "https://api.fintoc.com/v2/checkout_sessions" \
  --header "Authorization: YOUR_SECRET_API_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '{
    "flow": "payment",
    "amount": 25000,
    "currency": "CLP",
    "customer": "cus_3B2bODrQFje7ZVkT69xyaTSDwXQ",
    "payment_method_types": ["card"],
    "success_url": "https://merchant.com/success",
    "cancel_url": "https://merchant.com/cancel"
  }'
```

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

const fintoc = new Fintoc('YOUR_SECRET_API_KEY');

const checkoutSession = await fintoc.v2.checkoutSessions.create({
  flow: 'payment',
  amount: 25000,
  currency: 'CLP',
  customer: 'cus_3B2bODrQFje7ZVkT69xyaTSDwXQ',
  payment_method_types: ['card'],
  success_url: 'https://merchant.com/success',
  cancel_url: 'https://merchant.com/cancel'
});
```

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

client = Fintoc('YOUR_SECRET_API_KEY')

checkout_session = client.v2.checkout_sessions.create(
    flow='payment',
    amount=25000,
    currency='CLP',
    customer='cus_3B2bODrQFje7ZVkT69xyaTSDwXQ',
    payment_method_types=['card'],
    success_url='https://merchant.com/success',
    cancel_url='https://merchant.com/cancel'
)
```

Fintoc responds with the created `CheckoutSession`, including its `redirect_url`:

```json theme={null}
{
  "id": "cs_VvO7kpUMWlq2N10B",
  "object": "checkout_session",
  "flow": "payment",
  "status": "created",
  "amount": 25000,
  "currency": "CLP",
  "customer": {
    "id": "cus_3B2bODrQFje7ZVkT69xyaTSDwXQ",
    "object": "customer",
    "email": "jon@snow.com",
    "metadata": {},
    "name": "Felipe Castro",
    "tax_id": null
  },
  "payment_method": null,
  "payment_method_types": ["card"],
  "success_url": "https://merchant.com/success",
  "cancel_url": "https://merchant.com/cancel",
  "redirect_url": "https://pay.fintoc.com/checkout/cs_VvO7kpUMWlq2N10B",
  "metadata": {}
}
```

Redirect your customer to the `redirect_url`. Checkout shows one button per saved card, labeled with the card brand and its last four digits (for example, `Visa •••• 1234`), above the option to enter a new card. Fintoc creates the payment only when your customer picks a card. Your customer can still enter a different card instead.

You can add other types to `payment_method_types`, such as `bank_transfer`. Checkout then shows the saved cards together with the other payment methods.

## Option 2: Preselect a saved card

If your customer already picked the card on your website, send its `id` in `payment_method`. Send `payment_method_types` set to exactly `["card"]`, and the `customer` that owns the card.

**Server**

```bash theme={null}
curl --request POST "https://api.fintoc.com/v2/checkout_sessions" \
  --header "Authorization: YOUR_SECRET_API_KEY" \
  --header "Content-Type: application/json" \
  --data-raw '{
    "flow": "payment",
    "amount": 25000,
    "currency": "CLP",
    "customer": "cus_3B2bODrQFje7ZVkT69xyaTSDwXQ",
    "payment_method": "pm_3BgHP7aSqsqLiEcotFQfyx7Of8u",
    "payment_method_types": ["card"],
    "success_url": "https://merchant.com/success",
    "cancel_url": "https://merchant.com/cancel"
  }'
```

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

const fintoc = new Fintoc('YOUR_SECRET_API_KEY');

const checkoutSession = await fintoc.v2.checkoutSessions.create({
  flow: 'payment',
  amount: 25000,
  currency: 'CLP',
  customer: 'cus_3B2bODrQFje7ZVkT69xyaTSDwXQ',
  payment_method: 'pm_3BgHP7aSqsqLiEcotFQfyx7Of8u',
  payment_method_types: ['card'],
  success_url: 'https://merchant.com/success',
  cancel_url: 'https://merchant.com/cancel'
});
```

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

client = Fintoc('YOUR_SECRET_API_KEY')

checkout_session = client.v2.checkout_sessions.create(
    flow='payment',
    amount=25000,
    currency='CLP',
    customer='cus_3B2bODrQFje7ZVkT69xyaTSDwXQ',
    payment_method='pm_3BgHP7aSqsqLiEcotFQfyx7Of8u',
    payment_method_types=['card'],
    success_url='https://merchant.com/success',
    cancel_url='https://merchant.com/cancel'
)
```

Fintoc responds with the created `CheckoutSession`, including its `redirect_url`:

```json theme={null}
{
  "id": "cs_VvO7kpUMWlq2N10B",
  "object": "checkout_session",
  "flow": "payment",
  "status": "created",
  "amount": 25000,
  "currency": "CLP",
  "customer": {
    "id": "cus_3B2bODrQFje7ZVkT69xyaTSDwXQ",
    "object": "customer",
    "email": "jon@snow.com",
    "metadata": {},
    "name": "Felipe Castro",
    "tax_id": null
  },
  "payment_method": "pm_3BgHP7aSqsqLiEcotFQfyx7Of8u",
  "payment_method_types": ["card"],
  "success_url": "https://merchant.com/success",
  "cancel_url": "https://merchant.com/cancel",
  "redirect_url": "https://pay.fintoc.com/checkout/cs_VvO7kpUMWlq2N10B",
  "metadata": {}
}
```

| **Parameter** | **Requirement** | **Example** | **Description** |
| - | - | - | - |
| `customer` | Required | `"cus_3B2bODrQFje7ZVkT69xyaTSDwXQ"` | ID of the `Customer` that owns the saved card. |
| `payment_method` | Required to preselect a card | `"pm_3BgHP7aSqsqLiEcotFQfyx7Of8u"` | ID of the customer's saved `card` payment method. |
| `payment_method_types` | Required | `["card"]` | Must be exactly `["card"]` when `payment_method` is a saved card. |

Redirect your customer to the `redirect_url`. Checkout skips the list of payment methods and shows the confirmation of the preselected card.

If the request fails, Fintoc returns one of these errors:

| **Status** | **`code`** | **When** |
| - | - | - |
| `400` | `invalid_payment_method_types` | You sent `payment_method` for a saved card without `payment_method_types` set to exactly `["card"]`. |
| `403` | `forbidden_request` | Saved card payments are not enabled for your organization in the mode of your API key. Fintoc does not create the Checkout Session. The `message` refers to saved card payments as customer-initiated transaction (CIT) payments. |

## Your customer confirms and authenticates the payment

After your customer picks a card, or opens a session with a preselected card, Checkout shows the card and the amount:

1. **Installments.** If the card is a credit card issued in Chile, your customer can choose the number of installments. Checkout offers only the options the card supports among 1 to 12, 24, 36, and 48 installments. Debit and prepaid cards pay in a single installment.
2. **Confirmation.** Your customer confirms the payment.
3. **3DS authentication.** Every saved card payment goes through 3DS. The card issuer either approves it without asking your customer for anything (frictionless) or asks your customer to complete a challenge, such as a code sent by the bank.

Fintoc then charges the card and redirects your customer to your `success_url`.

## Handle the payment result

Always use webhooks to determine the final outcome. Your customer may close the tab, lose connection, or never reach your `success_url`.

| **Event** | **Description** | **Recommended action** |
| - | - | - |
| `checkout_session.finished` | Session successfully completed. | Update your records based on the final status. |
| `checkout_session.expired` | Session expired before completion. | Create a new Checkout Session if your customer still wants to pay. |
| `payment_intent.succeeded` | Payment succeeded. | Fulfill the order. |
| `payment_intent.failed` | Payment failed. | Create a new Checkout Session so your customer can pay again. |

Exception: you cannot retry a saved card payment inside the same Checkout Session. The session also cannot switch to another payment method, such as a bank transfer. If the payment fails, create a new Checkout Session for the next attempt.

> [!NOTE]
>
> Your customer starts a one-click payment in Checkout. To charge a saved card without your customer present, use an invoice or a Payment Intent. This applies to subscriptions and usage-based bills; see [Set up a payment method for future charges](https://docs.fintoc.com/guides/payments/accept-recurring-payments/setup-a-payment-method-for-future-charges.md).

## Test your integration

Use your [test mode API Secret Key](https://docs.fintoc.com/guides/resources/test-mode.md) to try the full flow without moving any money:

1. Save a test card for a `Customer` with a `setup` Checkout Session, using the test cards in [Set up a payment method for future charges](https://docs.fintoc.com/guides/payments/accept-recurring-payments/setup-a-payment-method-for-future-charges.md#test-your-integration).
2. Create a `payment` Checkout Session for the same `Customer`, without `payment_method`, and check that Checkout lists the saved card.
3. Create another session with the saved card in `payment_method`, and check that Checkout opens on the card confirmation.
4. Complete the payment and check that you receive `checkout_session.finished` and `payment_intent.succeeded`.
