Setup a Payment Method for future charges
Learn how to use Fintoc's Checkout Session API to enroll a customer's payment method, and then create charges against it.
Unlike the subscription flow — which couples enrollment with recurring billing — the setup flow lets you save a payment method without creating a subscription, ideal for on-demand or variable-amount charges.
There are four steps to set up a Payment Method and charge it later:
- On your backend, create a
Checkout Sessionwithflow: setup - Redirect your user to complete the enrollment at the Fintoc-hosted checkout page
- Handle post-session events to save the
payment_methodandcustomer - Create charges against the saved payment method using the
payment_intentAPI
The following diagram shows how the setup flow works:
Create a Session
The Checkout Session with the setup flow represents your intent to save a payment method for future charges, without creating a recurring subscription.
Using your Secret Key, create a Checkout Session on your backend with flow set to setup:
curl --request POST "https://api.fintoc.com/v2/checkout_sessions" \
--header "Authorization: YOUR_SECRET_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"flow": "setup",
"currency": "CLP",
"success_url": "https://merchant.com/success",
"cancel_url": "https://merchant.com/cancel",
"customer_data": {
"tax_id": {
"type": "cl_rut",
"value": "12088191"
},
"name": "Felipe Castro",
"email": "[email protected]"
},
"metadata": {}
}'| Parameter | Example | Description |
|---|---|---|
flow | setup | Required. Type of flow for the session. Use setup to save a payment method without charging. |
currency | CLP | Required. Currency for the session. Currently only CLP is supported for PAC setup. |
success_url | https://merchant.com/success | Required. URL to redirect the user after a successful PAC enrollment. |
cancel_url | https://merchant.com/cancel | Required. URL to redirect the user if they cancel the enrollment. |
payment_method_types | ["pac"] | Optional method available for the enrollment. Options are"pac" and "card" |
customer_data or customer | customer_data: { tax_id: {...}, ... } or customer: "cus_123" | Required. Customer information. Send customer_data to create a new customer inline, or customer with the ID of an existing customer. |
payment_method_options | { pac: { ... } } | Optional. Specific options for the PAC enrollment. Can include a bank pre-selection, so the customer will go direct to that bank's enrollment. |
metadata | { "order": "987654321" } | Optional set of key-value pairs for storing additional information. |
Difference from the subscription flowWhen you create a Checkout Session with
flow: setup, Fintoc enrolls and creates aPaymentMethod— but does not create anInvoicingSubscriptionor schedule any recurring charges. You control when and how much to charge creating future payment intents.
Include Customer Data (Required)
When creating a Checkout Session for setup, you must include customer information.
| Attribute | Type | Description |
|---|---|---|
tax_id | object | Required. Object with type (e.g. "cl_rut") and value (the RUT number). |
name | string | Optional. Full name of the customer. |
email | string | Optional. Email used to notify the customer about the enrollment and charges |
metadata | object | Optional. Custom key-value data for your records. |
Response when creating a Checkout Session
After creating the Checkout Session, Fintoc responds with the session details and a redirect_url:
{
"id": "cs_li5531onlFDi235",
"object": "checkout_session",
"flow": "setup",
"status": "created",
"currency": "CLP",
"customer": {
"name": "Felipe Castro",
"email": "[email protected]",
"tax_id": {
"type": "cl_rut",
"value": "12088191"
}
},
"success_url": "https://merchant.com/success",
"cancel_url": "https://merchant.com/cancel",
"redirect_url": "https://pay.fintoc.com/checkout/cs_li5531onlFDi235",
"metadata": {}
}Redirect the user to complete the enrollment
Next, redirect the user to the redirect_url from the response. The user will see the Fintoc-hosted checkout page where they complete the enrollment.
After completing the enrollment, the user is automatically redirected to your success_url or cancel_url depending on the outcome.
Handle post-session events
Always use webhooks to determine the final outcome. Users may close the tab, lose connection, or never reach your success_url.
Checkout Session events
When the enrollment completes, Fintoc sends a checkout_session.finished event with the customer and payment_method information:
{
"id": "evt_a4xK32BanKWYn",
"object": "event",
"type": "checkout_session.finished",
"data": {
"id": "cs_li5531onlFDi235",
"object": "checkout_session",
"mode": "live",
"flow": "setup",
"status": "finished",
"currency": "CLP",
"customer": {
"id": "cus_NffrFeUfNV2Hib",
"name": "Felipe Castro",
"email": "[email protected]",
"tax_id": {
"type": "cl_rut",
"value": "12088191"
}
},
"payment_method": "pm_NffrFeUfNV2Hib",
"setup_intent": "seti_3AUiBT4dia35S27G7mK8RnQg2SK",
"metadata": {},
"success_url": "https://merchant.com/success",
"cancel_url": "https://merchant.com/cancel"
}
}Payment Method events
You will also receive a payment_method.activated event with the details of the new saved payment method:
{
"id": "pm_3BgHP7aSqsqLiEcotFQfyx7Of8u",
"object": "payment_method",
"card": null,
"created_at": "2021-10-15T15:22:11.474Z",
"customer": "cus_NffrFeUfNV2Hib",
"mode": "live",
"metadata": {},
"pac": {
"account_holder_id": "257932338",
"account_number": "19831940978",
"account_type": "checking_account",
"institution_id": "cl_banco_falabella",
"status": "active",
},
"type": "pac"
}Store both the customer ID and the payment_method ID — you will need them to create charges later.
Events summary
You should subscribe to all the following post-session events:
| Event | Description | Recommended action |
|---|---|---|
checkout_session.finished | Session successfully completed. Method enrolled. | Store customer + payment_method. |
checkout_session.expired | Session expired before the user completed enrollment. | Allow the user to retry. |
payment_method.activated | Payment method is active and ready for charges. | Create charges on that method in the future. |
payment_method.canceled | Payment method is canceled and not available for charges. | Disable the charges creations for the method. |
Create a charge against the saved payment method
Once you have a saved payment_method, you can create charges against it by creating a Payment Intent passing the payment_method and customer ID:
cURL
curl --request POST "https://api.fintoc.com/v2/payment_intents" \
--header "Authorization: YOUR_SECRET_API_KEY" \
--header "Content-Type: application/json" \
--data-raw '{
"amount": 150000,
"currency": "CLP",
"customer": "cus_NffrFeUfNV2Hib",
"payment_method": "pm_NffrFeUfNV2Hib",
"metadata": {
"order_id": "order_98765"
}
}'| Parameter | Example | Description |
|---|---|---|
amount | 150000 | Required. Amount to charge, in the smallest unit of the currency (e.g., CLP without decimals). |
currency | CLP | Required. Currency for the payment. |
customer | cus_NffrFeUfNV2Hib | Required. The customer ID |
payment_method | pm_NffrFeUfNV2Hib | Required. The saved payment method ID. |
metadata | { "order_id": "order_98765" } | Optional. Additional metadata for your records. |
Handle payment events
Subscribe to the following events to track the payment outcome:
| Event | Description | Recommended action |
|---|---|---|
payment_intent.succeeded | The charge was successful. | Fulfill the order. Confirm to the customer. |
payment_intent.failed | The charge failed. | Retry the charge or ask for another payment method. |
Test your integration
Using your test mode API Secret Key, create Checkout Sessions that simulate the full setup and payment flow without moving any money.
1) Create a setup Checkout Session using test credentials
Create a Checkout Session with flow: setup using your test mode Secret Key. Complete the enrollment flow on the Fintoc-hosted page using the following credentials:
Test credentials:
PAC:
- Username (RUT):
41614850-3 - Password:
jonsnow - Select the account based on the final outcome you want to test:
| 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'] |
Card:
| Card Number | Expiration Date | CVV | Holder Name | 3DS Challenge Code | Final Result |
|---|---|---|---|---|---|
| 4111111111111111 | Any future date | Any | Any | - | ✅ Succeeded |
| 4456524869770255 | Any future date | Any | Any | 1234 | ✅ Succeeded if code is correct |
| 4574441215190335 | Any future date | Any | Any | - | ❌ Failed due to invalid credentials |
| 4349003000047015 | Any future date | Any | Any | - | ❌ Failed due to rejected transaction |
2) Verify the saved payment method
After completing the test enrollment, you should receive the checkout_session.finished and payment_method.activated webhook events. Verify that:
- The
payment_methodID is present in the event payload - The
customerID is correctly associated
3) Create a test charge against the saved method
Using the customer and payment_method IDs from step 2, create a payment Checkout Session with flow: payment. Verify that:
- The
payment_intent.succeededevent is received - The amount matches what you sent
- The payment method used is the saved PAC or card
Updated about 2 hours ago