Skip to main content
Fintoc provides the card number, expiry date, and card verification value (CVV) fields as iframes. You build the rest of the interface and confirm the payment from your backend, without handling card data. Checkout Fields is available for organizations in Chile.

When to use Checkout Fields

Compare the options by who controls the interface and the integration effort: Use Checkout Fields if you already have your own checkout (payment method selector, installments, promotions) and want to keep it. Checkout Fields uses the same objects as the current API: Checkout Sessions, Payment Intents, and Payment Methods. You confirm the payment on the Checkout Session, and Fintoc creates the Payment Intent for you.

How it works

The following diagram shows how Fintoc interacts with your frontend and backend: If the issuer requires 3-D Secure (3DS) authentication, Fintoc shows the challenge in a modal over your page before the submit resolves. Fintoc charges the card only when your backend confirms the Checkout Session. Your server never handles card data (step 7): it only handles the session_token, the confirm call, and the webhook.

Create a Checkout Session

When the customer reaches the payment step, your backend creates a Checkout Session with ui_mode: "fields" using your Secret Key. The session stores the order (amount, currency, allowed methods) and passes only its session_token to the frontend. With ui_mode: "fields", payment_method_types is required and must be ["card"]. You can’t send success_url, cancel_url, or payment_method. Server: create a Checkout Session
Response (abbreviated):
Response
customer is optional; it is required to save cards. See the Customer object.

Restrict the accepted cards

To accept only some cards, send payment_method_options.card when you create the Checkout Session:
  • kinds: card kinds to accept. Possible values are credit, debit, and prepaid.
  • bins: bank identification numbers (BINs) to accept, with 6 or 8 digits each. The card number must start with one of them.
If a card doesn’t meet the restriction, the card number field returns an error when the customer leaves it: card_kind_not_permitted for the kind, or card_bin_not_permitted for the BIN. The customer sees the error before submitting the card.

Load the secure fields

Load Fintoc.js and initialize it with your Public Key and the session’s session_token. Each sensitive field mounts inside your container as an iframe served from wizard.fintoc.com; your JavaScript cannot read its contents. Client
checkout.html
checkout.js
You collect the cardholder name with your own input because it is not card data. Fintoc sets the placeholder of each field. Fintoc.create returns an object with submit(), to submit the card, and destroy(), to remove the fields from your page.

Read the state of the fields while the customer types

Fintoc calls the onChange function that you pass to Fintoc.create when the state of a field changes. The data never includes the value the customer types, only the following data: Use this data to show your own error messages before the customer pays. onChange doesn’t include the card brand, kind, or installments.

Submit the card data

When the customer clicks Pay, call cardFields.submit(). The card number field collects the number, expiry date, and CVV from the three iframes and sends them to Fintoc in one request. If the issuer requires 3DS, Fintoc shows the challenge in a modal over your page. Fintoc doesn’t charge the card yet. Client
checkout.js
holderName is required. holderTaxId is optional: the tax ID of the cardholder, which can be different from the tax_id of the Customer. Send it as an object with type and value. For type, use cl_rut for a Chilean tax ID (RUT), mx_rfc for a Mexican tax ID (RFC), or custom for any other ID. installments is optional and defaults to 1. If holderTaxId doesn’t have this shape, or the RUT isn’t valid, cardFields.submit() returns the invalid_holder_tax_id error. The promise never includes sensitive card data. It resolves with the following data:
If status is ready, your frontend calls your backend without any card data, and the backend confirms the Checkout Session (the next step). If status is error, display error.message and let the customer correct the fields. The promise resolves with error instead of throwing an exception.

3DS authentication

You don’t write code to open or close the 3DS modal that cardFields.submit() shows. cardFields.submit() resolves only when the challenge ends, so it can take as long as the customer needs. Keep your loading state until the promise resolves. If the authentication fails, or the customer cancels it on the issuer’s page, the promise resolves with status: 'error' and the authentication_failed error. If the issuer’s page doesn’t load within 30 seconds, Fintoc closes the modal and the promise resolves with the challenge_load_timeout error. In both cases, Fintoc doesn’t charge the card.

Confirm the Checkout Session payment

When your frontend receives ready, your backend confirms the Checkout Session with your Secret Key. Fintoc charges the card that the customer submitted. The request has no body. Server
Confirm Checkout Session
When the charge succeeds, the Payment Intent becomes succeeded, and the Checkout Session becomes finished. Wait for payment_intent.succeeded before treating the order as paid. If the result of the charge isn’t available yet, Fintoc responds with 202 Accepted: confirm the Checkout Session again to get it. If the issuer declines the card, let the customer correct the card, submit it again, and confirm again.

Save a customer’s card

Save a card as a Payment Method to charge it later. You can save the card during a payment or without charging it.

Save a card during a payment

You can save the card as a Payment Method while the customer pays, to charge it again later.
  1. Create the Checkout Session with save_payment_method: "enabled" and a customer that already exists, or customer_data to create one. See the Customer object.
  2. Send savePaymentMethod: true in cardFields.submit().
Server
Client
checkout.js
You decide when to save the card. For example, show a checkbox and send what the customer chose, or always send true. Because the checkbox is on your page, you are responsible for asking the customer for consent. If you send true but the Checkout Session doesn’t have save_payment_method: "enabled", cardFields.submit() returns the save_payment_method_not_enabled error. If savePaymentMethod isn’t a boolean, cardFields.submit() returns invalid_save_payment_method. Fintoc saves the card only if the payment succeeds. When the payment succeeds, Fintoc sends the payment_method.activated webhook. The Checkout Session includes the Payment Method ID in payment_method, both in the confirm response and when you get the session. Store that ID from your backend. The cardFields.submit() response doesn’t include the ID, because Fintoc hasn’t charged the card yet. To save the card, Fintoc prepares the card during cardFields.submit(), which can add up to 30 seconds. Keep your loading state until the promise resolves. If Fintoc can’t prepare the card, cardFields.submit() still returns ready and the payment continues without saving the card. In that case, the Checkout Session doesn’t include payment_method, and you don’t receive payment_method.activated. If the issuer also requires a 3DS challenge, Fintoc prepares the card first. Fintoc then shows the challenge modal, so the modal takes longer to appear. Keep your loading state during the entire cardFields.submit(), including that wait. If authentication fails or the customer cancels the challenge on the issuer’s page, cardFields.submit() returns the authentication_failed error. Fintoc doesn’t charge or save the card, so you don’t receive payment_method.activated.

Save a card without an immediate payment

Use a Checkout Session with flow: "setup" to save a card without charging it. For example, let your customer add a card from their account settings before making a purchase.

Create a setup Checkout Session

From your backend, create a Checkout Session with flow: "setup", ui_mode: "fields", and payment_method_types: ["card"]. Send an existing customer, or use customer_data to create one. Server
The response includes the session_token, as in the payment flow:
Response (abbreviated)
Pass only that token to your frontend. A setup session has no amount. With ui_mode: "fields", you don’t need success_url or cancel_url because your customer stays on your page. You don’t need save_payment_method: "enabled": the setup flow saves the card without a payment. You can apply the same payment_method_options.card.kinds restriction described above. bins doesn’t apply to the setup flow.

Collect and save the card

Load the secure fields with the setup session’s session_token and your Public Key. Use the same containers and Fintoc.create configuration as in the payment flow, but label your button Save card. Ask your customer for consent before saving the card. onChange works as in the payment flow. When your customer clicks Save card, submit the card with cardFields.submit(). Send holderName and, optionally, holderTaxId, as in the payment flow, without installments or savePaymentMethod: Client
checkout.js
When Fintoc saves the card, the call returns status: "ready" with the saved card. In the setup flow, ready means Fintoc already saved the card. Unlike the payment flow, setup doesn’t require 3DS or a backend call to confirm the Checkout Session. If the submission fails, show error.message and let your customer retry.

Store the saved Payment Method

Handle payment_method.activated on your backend to know when the card is available for charges. Store the Payment Method ID with the corresponding customer. The Checkout Session also includes the saved ID in payment_method, available when you get the session or receive checkout_session.finished. Handle checkout_session.expired by letting your customer start a new setup session. Don’t wait for payment_intent.succeeded: setup doesn’t process a payment. To charge the card later, follow Pay with a saved card.

Pay with a saved card

To charge a saved card while the customer is on your page, your backend creates a Payment Intent. The customer doesn’t type card data, so you don’t load the secure fields or create a Checkout Session.
Paying with a saved card while the customer is present (off_session: false) is available for CLP payments of organizations in Chile. You can include a split array. Fintoc validates the array before charging the card, with the same rules and error codes as a split Payment Intent. If your organization can’t charge saved cards with the customer present, creating the Payment Intent returns 403 Forbidden.

List the customer’s saved cards

Use GET /v2/payment_methods with the customer and payment_options[off_session]=false query parameters. With payment_options[off_session]=false, the list includes only the customer’s active cards that you can charge while the customer is present. The list leaves out cards saved from a wallet and all payment methods that aren’t cards. If your organization can’t charge saved cards with the customer present, the list is empty. The following response example uses the documented Payment Method object. Display the card’s brand, last_four_digits, and expiration in your interface: Server
List saved cards
Saved cards response

Get the available installments

When the customer chooses a saved card, get its available installments for the amount to charge. You don’t have the card’s BIN, so Fintoc calculates them from the Payment Method. Server
Get installments
Installments response
amount must be a positive integer in the smallest currency unit, and currency must be CLP. The available_installments array is empty for debit and prepaid cards, and for cards issued outside Chile. If the Payment Method isn’t a card, or the card is canceled, inactive, or has no network token, Fintoc responds with 422 Unprocessable Entity and the invalid_payment_method_state error code. See Get the installments of a payment method. If the installments lookup fails, Fintoc responds with 503 Service Unavailable and the installments_temporarily_unavailable error code. Retry the request. An empty available_installments array means the customer pays in a single installment.

Create the Payment Intent

Create a Payment Intent with the saved Payment Method ID in payment_method. Set off_session to false to indicate that the customer is on your page and chose the card, and set payment_method_options.card.installments to the number of installments. payment_method_options is optional: without it, Fintoc charges the card in a single installment. To charge more than one installment, the number must be one of the card’s available_installments; otherwise, Fintoc responds with 400 Bad Request. If you omit off_session or set it to true, Fintoc charges the Payment Method without the customer present, as with any other saved payment method. In that case, if you send payment_method_options, Fintoc responds with 400 Bad Request. If you charge more than one installment and the installments lookup fails while creating the Payment Intent, Fintoc responds with 503 Service Unavailable and the installments_temporarily_unavailable error code. Fintoc doesn’t create the Payment Intent. Retry the request with a new Idempotency-Key. A retry with the same key returns the stored 503 response for 24 hours. If the card provider is unavailable when Fintoc reads the saved card, Fintoc responds with 503 Service Unavailable and error.code set to provider_unavailable. Fintoc doesn’t create the Payment Intent. Retry the request with a new Idempotency-Key or without one. A retry with the same key returns the stored 503 response for 24 hours. If the saved card is canceled, Fintoc responds with 422 Unprocessable Entity and error.code set to payment_method_canceled. If the card is inactive, Fintoc responds with 422 Unprocessable Entity and error.code set to payment_method_inactive. These are the same error codes as a charge without the customer present. With off_session set to false, Fintoc doesn’t create the Payment Intent. Ask your customer to choose another card or pay with new card details. Server
Create Payment Intent
Response (abbreviated):
Response
Fintoc responds with 201 Created. If the payment requires 3DS authentication, the Payment Intent has the requires_action status, a widget_token, and a next_action of type card_authentication. Fintoc charges the card only after your page completes the authentication, so always handle requires_action. The widget_token is only returned in this response.

Handle the 3DS authentication

Your backend passes the widget_token to your page. Your page loads Fintoc.js and calls Fintoc.handleNextAction() with your Public Key and the token: Client
checkout.html
checkout.js
If the issuer requires a challenge, Fintoc shows it in a modal. Keep your loading state until the promise resolves. The promise resolves with { status: 'succeeded' } or with { status: 'error', error: { code, message } }, and never throws an exception. To update the order, use the payment_intent.succeeded, payment_intent.failed, and payment_intent.expired webhooks. If your page sets a Content Security Policy, it needs the same domains as the secure fields. See Content Security Policy.

Show more than one card form

You can show more than one card form on the same page. Each form has its own Checkout Session, its own containers, and its own Fintoc.create call. The card number field only collects the data of its own form.
  • Discounts for some cards: you can’t change the amount of a Checkout Session. If you offer a discount for some cards, for example, the cards of one bank, show a separate form for them. Create its Checkout Session from the start with the discounted amount and payment_method_options.card.bins, so Fintoc rejects other cards in that form.
  • Credit and debit cards in separate forms: create two Checkout Sessions, one with kinds: ["credit"] and the other with kinds: ["debit"]. If the customer types a debit card in the credit form, the card number field returns an error.
  • Card and bank transfer: create a separate Checkout Session with payment_method_types: ["bank_transfer"] and open it in the Fintoc Widget with Fintoc.create. You can create that session when the customer chooses bank transfer, so you don’t leave unused sessions.

States, webhooks, and errors

Treat the order as paid only when the payment_intent.succeeded webhook arrives.
For a payment, the Checkout Session moves from created to in_progress when the customer submits a card, and to finished when the related Payment Intent reaches a final state. For setup, the Checkout Session finishes when the card setup completes, without a payment. The Checkout Session moves to expired if expires_at is reached before the customer submits a card. Handle Payment Intent states as follows: Webhooks: checkout_session.finished, checkout_session.expired, payment_intent.succeeded, payment_intent.failed, payment_intent.expired, payment_method.activated. Common errors (in error.code):

Customization and security

Appearance

The fields look like the rest of your form:
  • Container: you style the border, background, and label of each field with your own CSS on its container. Fintoc adds the fintoc-focus, fintoc-empty, fintoc-invalid, and fintoc-complete classes to the container according to the field’s state. An empty field isn’t invalid: use fintoc-empty to decide whether to mark it.
  • Text inside the field: configure it with cardFields.style when you call Fintoc.create. style.base applies to the input text in every state. style.placeholder applies to the placeholder, and style.invalid applies to the text of an invalid value. placeholder and invalid replace only the base properties they set. Each variant accepts color, fontSize, fontWeight, letterSpacing, lineHeight, and textAlign. base also accepts fontFamily with the name of a Google Fonts family. Fintoc ignores any other property.
You control the labels, error messages, and layout; the iframes only render the input.

Content Security Policy

If your page sets a Content Security Policy (CSP), add Fintoc’s domains to it: The secure fields and the 3DS modal are iframes served from wizard.fintoc.com. The issuer’s page loads inside the modal’s iframe, so you don’t add the issuer’s domains. The modal doesn’t need style-src 'unsafe-inline'. If your page doesn’t set a CSP, you don’t need to configure anything.

Mobile apps

Checkout Fields works the same way on a web page inside a webview.

Test the integration

Use your test Public Key and Secret Key in this guide’s examples. Use the published card payment test data instead of real card data. Start with these Chilean card scenarios: Verify the following outcomes with the flow described above:
  1. Create a Checkout Session with ui_mode: "fields" and check that you receive the session_token.
  2. Load the secure fields and type a test card. Check that onChange returns complete: true for the three fields.
  3. Submit the test data. Check that your frontend receives status: "ready" without receiving card data.
  4. Confirm the Checkout Session from your backend. For a successful payment, verify that you receive payment_intent.succeeded before treating the order as paid.
To test saving a card without a payment, create a session with flow: "setup" and submit a test card. Verify that you receive payment_method.activated and checkout_session.finished, and store the session’s payment_method. Don’t call the confirm endpoint or expect a payment webhook for this flow. To test saving a card during a payment, create the session with save_payment_method: "enabled" and a customer, submit 5120342233150747 with savePaymentMethod: true, and confirm the Checkout Session. Verify that you receive payment_method.activated and that the confirm response includes payment_method. With 4000080000000004, the payment succeeds without saving the card, matching the outcome when Fintoc can’t prepare the card. To test paying with a saved card, list the customer’s cards with payment_options[off_session]=false, get the available installments for one of them, and create the Payment Intent with off_session: false. If the response has the requires_action status, call Fintoc.handleNextAction() with the widget_token from the response. Verify that you receive payment_intent.succeeded.
Find the sandbox test data and expected results in Test your integration: card payments.