Create a Payment Intent

Request to create a bank transfer

To create a bank transfer, you need to make a request to create a Payment Intent resource.

curl --request POST "https://api.fintoc.com/v1/payment_intents" \
-- header 'Authorization: sk_live_0000000000000000' \
-- header 'Content-Type: application/json' \
--data-raw '{
  "amount": 2476,
  "currency": "CLP",
  "recipient_account": {
    "holder_id": "111111111",
    "number": "123123123",
    "type": "checking_account",
    "institution_id": "cl_banco_de_chile"
  }
}'
const fetch = require('node-fetch');

const payment_intent = {
  amount: 1000,
  currency: 'clp',
  recipient_account: {
    holder_id: "111111111",
    number: "123123123",
    type: "checking_account",
    institution_id: "cl_banco_de_chile"
  },
}

fetch('https://api.fintoc.com/v1/payment_intents', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'sk_live_000000000000'
    },
    body: JSON.stringify(payment_intent),
  },
)
import requests

payment_intent = {
  'amount': 1000,
  'currency': 'clp',
  'recipient_account': {
    'holder_id': '111111111',
    'number': '123123123',
    'type': 'checking_account',
    'institution_id': 'cl_banco_de_chile'
  }
}

headers = {
  'Accept': 'application/json', 'Authorization': 'sk_live_000000000000'
}

r = requests.post(
  'https://api.fintoc.com/v1/payment_intents',
  json=payment_intent,
  headers=headers
)
require 'net/http'
require 'uri'
require 'json'

payment_intent = {
  amount: 1000,
  currency: 'clp',
  recipient_account: {
    holder_id: '111111111',
    number: '123123123',
    type: 'checking_account',
    institution_id: 'cl_banco_de_chile'
  }
}

uri = URI("https://api.fintoc.com/v1/payment_intents")

header = {
  Accept: 'application/json', Authorization: 'sk_live_000000000000'
}

http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri, header)
request.body = payment_intent.to_json

response = http.request(request)

In your request you must send 3 very important fields: amount, currency and recipient_account.
For payments in MΓ©xico, you can optionally send a reference_number

ParameterExampleExplanation
amount2476Amount of money that needs to be paid. It's represented as integer with no decimals in the smallest possible unit of the currency you are using.

If your payment uses Chilean peso, an amount of CLP 2476 is represented as 2476.

If your payment uses Mexican peso, an amount of MXN 24.76 is represented as 2476.

Read here to learn more.
currencyCLPCurrency that is being used for the payment. We currently support CLP and MXN.
reference_number1234567Reference number to identify the payment in SPEI. It has a maximum of 7 digits.
recipient_accountAccount ObjectAccount receiving the bank transfer

The recipient_account field corresponds to an Account object. Depending on the country, the Account object is conformed by different attributes.

Chile πŸ‡¨πŸ‡±

In Chile, the Account object needs to be conformed by 4 attributes: holder_id, number, type, institution_id.

ParameterExampleExplanation
holder_id193426816Account holder's RUT
number1836027172Account number
typechecking_accountType of account. Supported types are checking_account and sight_account.
institution_idcl_banco_de_chileFintoc institution id for the bank receiving the bank transfer. You can see the code for each bank here.

Mexico πŸ‡²πŸ‡½

In Mexico, the Account object is only conformed by the CLABE number.

ParameterExampleExplanation
number014560250113982906The CLABE number is an 18 digit unique identifier which contains details of the bank brand and location, as well as the individual account number.

🚧

Mexican representation as integer

The Fintoc API represents currencies in its smallest possible units with no decimals (as an integer). That means that an amount of MXN 10.29 gets represented by Fintoc as 1029. You can read more about currencies here.

In the example below, we create a Payment Intent of an amount of MXN 10.29

curl --request POST \
     --url https://api.fintoc.com/v1/payment_intents \
     --header 'Authorization: sk_test_ZmHdrkZGYby32tsVYdf4wrYxKRt2gD3g' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
     "amount": 1029,
     "currency": "MXN",
     "recipient_account": {
          "number": "014560250113982906"
     }
}
'

Response when creating a bank transfer

After making the request to create the Payment Intent, Fintoc should respond with something like this:

{
  "id": "pi_BO381oEATXonG6bj",
  "object": "payment_intent",
  "amount": 1000,
  "currency": "CLP",
  "widget_token": "pi_BO381oEATXonG6bj_sec_a4xK32BanKWYn",
  "status": "created",
  "metadata": {},
  "reference_id": null,
  "recipient_account": {
    "holder_id": "183917137",
    "number": "123456",
    "type": "checking_account",
    "institution_id": "cl_banco_de_chile"
  },
  "sender_account": null,
  "created_at": "2021-10-15T15:23:11.474Z",
}

The attributes of recipient_account will vary depending if the Payment Intent is for a Chilean bank transfer or a Mexican bank transfer.

The values of the attributes reference_id and sender_account will be null. Once the bank transfer starts to be processed, these fields will populate.

Once the transfer is completed successfully, the reference_id field will correspond to the operation number that the bank assigned to the transfer.

πŸ“˜

Widget Token

You will only receive the widget_token field when creating the Payment Intent. After that, every request to get an existing Payment Intent from Fintoc will return with that field empty. Remember that you need to use the widget_token to instantiate the widget on the client side!

❗️

Expiration

A Payment Intent expires after 10 minutes. After 10 minutes of the Payment Intent being created, the widget won't accept the widget_token of the expired Payment Intent, and you will have to create a new one.