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:

  1. On your backend, create a Checkout Session with flow: setup
  2. Redirect your user to complete the enrollment at the Fintoc-hosted checkout page
  3. Handle post-session events to save the payment_method and customer
  4. Create charges against the saved payment method using thepayment_intent API

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": {}
  }'
ParameterExampleDescription
flowsetupRequired. Type of flow for the session. Use setup to save a payment method without charging.
currencyCLPRequired. Currency for the session. Currently only CLP is supported for PAC setup.
success_urlhttps://merchant.com/successRequired. URL to redirect the user after a successful PAC enrollment.
cancel_urlhttps://merchant.com/cancelRequired. 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 customercustomer_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 flow

When you create a Checkout Session with flow: setup, Fintoc enrolls and creates a PaymentMethod — but does not create an InvoicingSubscription or 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.

AttributeTypeDescription
tax_idobjectRequired. Object with type (e.g. "cl_rut") and value (the RUT number).
namestringOptional. Full name of the customer.
emailstringOptional. Email used to notify the customer about the enrollment and charges
metadataobjectOptional. 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:

EventDescriptionRecommended action
checkout_session.finishedSession successfully completed. Method enrolled.Store customer + payment_method.
checkout_session.expiredSession expired before the user completed enrollment.Allow the user to retry.
payment_method.activatedPayment method is active and ready for charges.Create charges on that method in the future.
payment_method.canceledPayment 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"
    }
  }'
ParameterExampleDescription
amount150000Required. Amount to charge, in the smallest unit of the currency (e.g., CLP without decimals).
currencyCLPRequired. Currency for the payment.
customercus_NffrFeUfNV2HibRequired. The customer ID
payment_methodpm_NffrFeUfNV2HibRequired. 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:

EventDescriptionRecommended action
payment_intent.succeededThe charge was successful.Fulfill the order. Confirm to the customer.
payment_intent.failedThe 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 numberType of MFACorrect code
813990168Security device000000
422159212Mobile Application - SuccessN/A
5233137377Mobile Application - FailureN/A
170086177SMS0000
746326042Coordinate Card['00', '00', '00']

Card:

Card NumberExpiration DateCVVHolder Name3DS Challenge CodeFinal Result
4111111111111111Any future dateAnyAny- Succeeded
4456524869770255Any future dateAnyAny1234 Succeeded if code is correct
4574441215190335Any future dateAnyAny-❌ Failed due to invalid credentials
4349003000047015Any future dateAnyAny-❌ 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_method ID is present in the event payload
  • The customer ID 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.succeeded event is received
  • The amount matches what you sent
  • The payment method used is the saved PAC or card