Finish the bank transfer

Once a Payment Intent succeeds, two "notifications" will be triggered. One of these will be to your backend as an asynchronous webhook and the other will be to your frontend as a synchronous callback. Each has its own purpose.

Sync notification (on the frontend, as a callback on the widget)

Once a bank transfer finishes successfully, the widget executes the onSuccess callback. You need to pass this function to the widget upon creation.

With this callback, you can decide what to do with your user's frontend once the transfer has been made, for example:

  • Redirect the user to a post-sale or post-transfer view
  • Notify your server that the bank transfer was successfully executed and that it can now validate it with a request to Fintoc.

📘

You shouldn't trust on the onSuccess callback as a confirmation for a successful payment/transfer, as the frontend is an insecure realm and a malicious third party may execute a JavaScript function that simulates that the transfer was executed successfully.

For validation, we recommend that, once the onSuccess callback executes, a request is sent to the server and from there you should be able to securely validate (using the Retrieve Payment Intent endpoint) that the transfer was successfully made.

Async notification (on the backend, as a webhook)

For this event to be heard by your application, you must first subscribe to it using the Fintoc Dashboard. You can read a bit more on the guide to activate webhook endpoints.

When a transfer is marked as succeeded, failed or rejected, Fintoc sends an event as a webhook with the payment_intent type looking like this:

{
  "id": "evt_a4xK32BanKWYn",
  "object": "event",
  "type": "payment_intent.succeeded",
  "data": {
    "id": "pi_BO381oEATXonG6bj",
    "object": "payment_intent",
    "amount": 1000,
    "status": "succeeded",
    "widget_token": null,
    "currency": "CLP",
    "metadata": {},
    "reference_id": "90123712",
    "recipient_account": {
      "holder_id": "183917137",
      "number": "123456",
      "type": "checking_account",
      "institution_id": "cl_banco_de_chile"
    },
    "sender_account": {
      "holder_id": "192769065",
      "number": "123456",
      "type": "checking_account",
      "institution_id": "cl_banco_estado"
    },
    "created_at": "2021-10-15T15:23:11.474Z",
  }
}

There are 3 types of payment events:

EventDescription
payment_intent.succeededEvent that triggers when a transfer is validated as successful.
payment_intent.failedEvent that triggers when a transfer fails due to a problem with the bank or with Fintoc.
payment_intent.rejectedEvent that triggers when a transfer is rejected by the user. This may happen when the user rejects the MFA or if it is entered incorrectly.