PSE Prerequisites

Intro

Before you can make use of our solution to make payments, we need to get you onboarded. During the process, we'll:

  • provide you with the provider’s Terminal ID and Form ID needed to process payments

👍

Get in touch!

If you would like to get started using Belvo’s Payments API, just contact us at [email protected] and we’ll get right to it. 🙂

Once you are all set up, you can use Belvo's PSE product to request payments from your users in as little as two steps!

  1. Create your Payments Secret Keys.
  2. Create a webhook to receive events from Belvo.
  3. Register your beneficiary bank account (this is the account that will receive all successful payments).
  4. (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.

All these steps are required in order to use our Payments API, but you just need to do it once and you're ready!

Postman collection

We’ve created a public Postman collection for you to quickly get set up using Belvo’s Payment Initiation API (PSE). 😉

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):

POST https://api.belvo.com/payments/secret-keys/
Authorization: Basic username:password

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",
      "created_at": "2022-02-09T08:45:50.406032Z",
      "last_used": "2022-02-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
  • there’s a status update in your user’s payment process
  • payments are completed

Check our Webhooks article for more info. 🤓

Register your organization’s bank account

Your organization’s bank account (the beneficiary) will collect all successful payments. To create your business bank account, you need to make a POST Create a new bank account call to our Bank Accounts resource.

{
     "holder": {
          "type": "BUSINESS",
          "information": {
               "name": "the_name_of_your_business"
          }
     },
     "providers": {
          "payments_way": {
               "terminal_id": "the_provider's_terminal_id", // Provided by Belvo
               "form_id": "the_provider's_form_id", // Provided by Belvo
          }
     },
  	"number": "beneficiary_bank_account_number"
}
{
     "holder": {
          "type": "BUSINESS",
          "information": {
               "name": "Trusty documentation services"
          }
     },
     "providers": {
          "payments_way": {
               "terminal_id": "123",
               "form_id": "321",
          }
     },
  	"number" "12343453245633"
}

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": "7c2be016-37e3-44e2-8643-db2eb1129a3f",
  "created_at": "2023-02-15T07:52:31.998761Z",
  "created_by": "417514fe-50f6-42e9-a3eb-c71da00f014c",
  "holder": {
    "type": "BUSINESS",
    "information": {
      "name": "Tr******es"
    }
  },
  "providers": {
    "payments_way": {
      "terminal_id": 123,
      "form_id": 321
    }
  },
  "number": "******5633"
}

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?

And you're all set! To start collecting payments from your customers, check our PSE Inflow Payments guide! :money-with-wings: