Redirect Page

Use Fintoc´s Payment Initiation product by redirecting your customer to a new page

When your customers choose to pay with Fintoc, the process works as follows:

  1. Checkout Session Creation: Your backend calls our API to create a Checkout Session. You must include a success_url and a cancel_url in your request.
  2. Receiving the Redirect URL: Our API responds with a session that contains a redirect_url. This URL is used to send your customer to our secure payment page.
  3. Customer Payment Flow: Your customer is redirected to our payment page, where they complete their payment on the Fintoc Widget.
  4. Return Flow: After the payment, your customer is automatically sent back to your site via the success_url or cancel_url provided.

Create a Checkout Session

Using your Secret Key, create a Checkout Session on your server with the success_url and cancel_url:

curl --request POST \
     --url https://api.fintoc.com/v1/checkout_sessions \
     -- header 'Authorization: YOUR_TEST_SECRET_API_KEY' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data-raw 
'{
  "amount": 1000,
  "currency": "CLP",
  "cancel_url": "https://merchant.com/987654321",
  "success_url": "https://merchant.com/success",
  "customer_email": "[email protected]",
  "metadata": {
      "order": "987654321"
    }
}'
ParameterExampleExplanation
amount2476Amount of money that needs to be paid. It's represented as an integer with no decimals in the smallest possible unit of the currency you are using.

An amount of MXN 24.76 is represented as 2476.

For cash payments, the maximum allowed amount is 500000 (5,000 MXN).
currencyMXNCurrency that is being used for the payment. We currently only support MXN for cash payments.
success_urlhttps://merchant.com/successURL to redirect the user in case of payment succeeded.
cancel_urlhttps://merchant.com/987654321URL to redirect the user in case they decide to cancel the payment and return to your website.
customer_email[email protected]Optional customer email linked to a Checkout Session. This is used to notify a user in case of a refund.
metadata{"order": "987654321"}Optional set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

Handling the API Response

After creating the checkout session, you’ll receive a response that includes a redirect_url along with other important parameters. For example:

{
  id: "cs_li5531onlFDi235",
  created_at: "2025-02-06T18:42:51Z",
  object: "checkout_session",
  currency:"CLP",
  amount: "1000",
  customer_email:"[email protected]",
  expires_at: "2025-02-06T18:52:51Z",
  mode: "live",
  status:"created",
  session_token: "cs_li5531onlFDi235_sec_a4xK32BanKWYn",
  cancel_url: "https://merchant.com/987654321",
  success_url: "https://merchant.com/success",
  "metadata": {
      "order": "987654321"
    },
  business_profile: {},
  redirect_url: "https://pay.fintoc.com/payment?checkout_sesion=cs_li5531onlFDi235"
}

Handling post-payment events

Fintoc sends a checkout_session.completed event when the payment is complete. Use the webhook guide 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.

Listen for these events rather than waiting on a callback from the client. From the client side, On the client, the customer could close the browser window or quit the app before the callback executes, and malicious clients could manipulate the response.

We recommend handling the following events:

EventDescriptionAction
checkout_session.finishedSent when a customer has completed a payment. The webhook contains information about the Payment including its final status.Depending on the final status of the related payment, confirm the order to the customer or offer to retry the payment.
checkout_session.expiredTriggers when a customer leaves the payment flow before finishingOffer the customer another attempt to pay.

📘

Learn more about webhooks

To learn more about how to create your own webhook endpoint, test your webhook endpoint and security best practices read our Webhooks guide