OFPI Prerequisites
Set everything up to use Belvoโs Open Finance Payment Initiation (OFPI) ๐
Intro
Before you can use our OFPI solution and start collecting payments, youโll need to:
-
Create your Payments Secret keys. Make sure you've already created your Belvo account.
-
Register your webhook so we can let you know about important events during the payment process, such as payment confirmations.
-
List the Belvo-supported payment institutions. Here we return the institution
id
that youโll need to create your bank account. -
Register your organizationโs bank account. This is the beneficiary account that will collect successful payments.
-
(Optional) Have your callback URLs prepared. These are URLs that the user should be redirected to when they complete or cancel a payment, or if an error occurs during the payment process.
Postman collection
Weโve created a private Postman collection for you to quickly get set up using Belvoโs Open Finance Payment Initiation (OFPI). ๐
If you need any help, just reach out to our team at [email protected] and weโll get right to it. ๐
Create your secret API keys
In order to use Belvo's Payments API, you need to first request your secret keys (see the code example below):
Where:
username
ย is the username you use to log in to the Belvo dashboard (in plain text).password
ย is the password you use to log in to the Belvo dashboard (in plain text).
If you have entered your credentials correctly, you will receive aย 201 Responseย with your secret keys:
[
{
"id": "Your Belvo secretID",
"password": "Your Belvo secretPassword", // This value is obfuscated.
"created_at": "2022-01-09T08:45:50.406032Z",
"last_used": "2022-01-09T08:45:50.406032Z"
}
]
For security reasons, we only show the secretPassword once after the generation. Make sure you store it securely to be able to retrieve it later.
Using your API keys for Basic Authentication
After you've retrieved your API keys, all following calls to the Belvo Payments API must be done using Basic Authentication.
curl \
-u username:password
https://api.belvo.com/payments/
Where:
username
ย is your secretID (in plain text).password
ย is your secretPassword (in plain text).
Register a webhook
Registering a webhook will let you know about any relevant updates that occur during the payment process. To set up a webhook, you need to make a POST request toย Register a new payment webhook with the following information:
{
"name": "Your webhook name",
"url": "Your webhook URL",
"auth_header": "Authorization",
"auth_token": "Bearer hv7alD71j0dzXf09iKfg7u"
}
In the response, weโll confirm the webhook was created and return the webhook id
(you can save this ID for future debugging purposes).
{
"id": "3b9a69f7-0f0a-455b-832d-49ad6fd4905c",
"name": "Your webhook name",
"url": "Your webhook URL",
"auth_header": "Authorization",
"auth_token": "*******",
"created_at": "2022-02-09T08:45:50.406032Z",
"created_by": "c232d66c-90cd-4aca-a32d-5c2e7f7799ba"
}
Webhooks notifications
Throughout this guide, weโll let you know when certain webhooks (and their types) are sent to the webhook URL. In this way, you can track the payment lifecycle and know when:
- a payment link is created is created
- thereโs a status update in your userโs payment process
- payments are completed
Check our Webhooks article for more info. ๐ค
Get your payment institution id
id
Youโll need to provide an institution id
(this is a unique ID in Belvoโs systems) to register your organizationโs bank account. To get your institutions.id
, you need to make a GET List all payment institutions call and then query our Institutions resource to find your banksโ id
. We return the following response:
{
"id": "bbaceead-7b96-46d8-9354-38dec9707004",
"active": true,
"name": "wakanda_national",
"display_name": "Wakanda National Bank",
"legal_entity_name": "Wakanda Bank, National Association",
"website": "https://www.wakandanational.com",
"logo": "https://belvo-api-media.s3.amazonaws.com/logos/wakandanational_logo.png",
"icon_logo": "https://belvo-api-media.s3.amazonaws.com/logos/wakandanational_icon_logo.png",
"text_logo": "https://belvo-api-media.s3.amazonaws.com/logos/wakandanational_text_logo.png",
"primary_color": "#fdbc24",
"country": "BRA",
"form_fields": [] // An array of input form fields for an institution.
}
Register your organizationโs bank account
You can register your organizationโs bank account to be the beneficiary account that will collect all successful payments. To register your bank account, you need to make a POST Create a new bank account call to our Bank Accounts resource. You can register as many organization bank accounts as you want.
{
"institution": "f512d996-583a-4a91-8b5b-eba2e103b068",
"holder": {
"type": "BUSINESS", // Must be set to BUSINESS
"information": {
"identifier_type": "CNPJ",
"name": "Caetano Veloso Entertainment Universe",
"identifier": "23100299900"
}
},
"details": {
"country": "BRA",
"account_type": "CHECKINGS",
"agency": "0444",
"number": "45722-0"
}
}
Youโll receive the following response from our API. Make sure you save the id
from the response - youโll use it as the beneficiary_bank_account
in the future when you create payment links. ๐ค.
{
"id": "1c83ead8-6665-429c-a17a-ddc76cb3a95e",
"created_at": "2020-04-23T21:30:20.336854+00:00",
"created_by": "62053a72-e2d5-4c95-a578-6b16616900ac",
"customer": "49f244ef-06cd-49cf-ad0c-f43796e370ad",
"institution": "f512d996-583a-4a91-8b5b-eba2e103b068",
"details": {
"country": "BRA",
"account_type": "CHECKINGS",
"agency": "0444",
"number": "45722-0"
},
"holder": {
"type": "BUSINESS",
"information": {
"identifier_type": "CNPJ",
"name": "Caetano Veloso Entertainment Universe",
"identifier": "23100299900"
}
}
}
Registering your customer's bank account as the beneficiary
You can also register and set your customer's bank account as the beneficiary account to collect all successful payments. Check our OFPI inflow payments guide for more info.
Have your callback URLs ready
These are URLs that youโll need to provide in a payment link request and will redirect your customer when they complete or cancel a payment, or if an error occurs during the payment process. Youโll need to provide cancel
and success
URLs:
"callback_urls": {
"cancel": "https://www.acmecorp.com/checkout/3487548/cancel",
"success": "https://www.acmecorp.com/checkout/3487548/success"
You won't need to provide callback URLs if your integration only generates payment links through the Belvo Dashboard. ๐
What's next?
You're all set! To start collecting payments from your customers, check our OFPI Inflow Payments guide!
Updated 4 months ago