Payment Subscriptions

Generate recurrent payments with the bank

Subscriptions allow your users to make recurrent payments right inside your application. The workflow is the following:

  1. Your user authorizes you to withdraw money directly from their bank account using Fintoc. Although this process is done within your application, it takes a maximum of 3 business days to complete.
  2. Once the user authorizes you, you can charge their bank account at regular intervals. Each charge takes 2 business days to receive acknowledgment of their success or failure. Because of this, it takes 3 business days since you charge your user for the money to reach your bank account.

Subscription authorization

Before you can create a charge, your user must first authorize you to debit their account. To get the user authorization, you need to use the Fintoc Widget. The widget handles all the authorization processes for you, including the error handling.

To start the subscription authorization, you must create the widget using the subscription product.

const widget = Fintoc.create({
  holderType,
  product: 'subscription',
  publicKey,
  webhookUrl,
  onSuccess,
  onExit,
})

The onSuccess callback executes once the subscription is successfully created and receives a link object as a parameter. You can read more about the widget and its configurations at the Widget documentation.

Successful subscription

When a subscription gets created succesfully, a link gets sent to your application containing the Link. Additionally, a subscription_id field gets sent. This field can be used to identify the subscription within Fintoc.

Creating a Charge

πŸ“˜

First charge

After a user successfully authorizes you, you need to wait 72 hours before the first charge.

Fintoc uses the Charge object to represent a subscription payment.

From your backend, create a Charge with the amount, currency, and the Subscription object you got in the authorization step. Always create the charge from your backend, or a malicious user could alter any of those fields.

Here's an example:

curl --request POST "https://api.fintoc.com/v1/charge" \
-- header 'Authorization: sk_live_0000000000000000' \
-- header 'Content-Type: application/json' \
--data-raw '{
  "amount": 1000,
  "currency": "CLP",
  "subscription_id": "sub_00000000"
}'

The response should look like this:

{
  "id": "ch_BO381oEATXonG6bj",
  "object": "charge",
  "amount": 1000,
  "currency": "CLP",
  "status": "pending",
  "reference_id": null,
  "subscription_id": "sub_00000000",
  "created_at": "2021-10-15T15:23:11.474Z",
}

Charge workflow

A charge take up to 2 business days to receive acknowledgment of their success or failure:

  • When created, charges have the initial status of pending.
  • Fintoc processes charges once a day, at 4 pm Chilean time. Charges created on or after 4 pm CL are currently processed on the next business day.
  • During the following 2 business days, the charge transitions to either succeeded or failed depending on the user's bank.
  • Successful charges are transferred to your bank account 24 hours after they transitioned to the successful state.
  • Your user sees the payment reflected on their bank statement 1 business day after creating the charge. (Your user knows if the charge succeeds before the bank notifies Fintoc.)

Failures can happen for a number of reasons, such as insufficient funds, the charged amount being higher than the authorized amount, or the customer disabling the authorization from their bank account.

Charge webhooks

Once the charge is completed, we will send you an event with charge as its type using a webhook.

To subscribe to the event, you must first have created a Webhook Endpoint using Fintoc and assign to it the events that you want to receive.

It is very important that you subscribe to these events, as you can use them to identify successful charges from failed ones.

Remember that with the Charge object can send you 2 different events using webhooks:

EventDescription
charge.succeededEvent that triggers when a charge is validated as successful.
charge.failedEvent that triggers when a charge fails due to insufficient funds, the charged amount being higher than the authorized amount, or the user disabling the authorization.

Available banks

Nombreid
Banco de Chilecl_banco_de_chile
Banco Scotiabankcl_banco_scotiabank
Banco Itaucl_banco_itau
Banco BCIcl_banco_bci
Banco Falabellacl_banco_falabella
Banco Santandercl_banco_santander

Sandbox

We offer a sandbox that can be used to test different flows when creating a subscription. When creating Links using the sandbox credentials, created Links always have the same checking accounts. The checking accounts included and their type of second factor authentication are the following:

Account NumberSecond Factor TypeCode
813990168Device (digipass)000000
746326042Coordinates card[00, 00, 00]
422159212AppSuccess
5233137377AppFailure