Skip to main content

How to use the Create Payment API?

Creating Payments with the API​

We provide the endpoint /api/v1/payment so you can create a new payment for the respective affiliated company.

You can find the documentation for this endpoint here.

As part of the request body, there are two payment modes: by Pix key and by QR Code:

  1. By Pix key, the fields value, destinationAlias, destinationAliasType and correlationID are required.
  2. By QR Code, the fields qrCode and correlationID are required.

Below is the description of each field, including the optional ones:

  • value: The amount in cents of the payment to be created.
  • destinationAlias: The destination Pix key of the created payment, in the format of its type. Phone numbers must always be in international format, with +55 and the area code (+5511912345684). See Pix key format.
  • destinationAliasType: The type of the destination Pix key of the created payment. Must be one of the following values: CPF, CNPJ, EMAIL, PHONE, RANDOM. Always send the type: a key that is both a CPF and a mobile number (ambiguous key) sent without it is rejected with 400. See Ambiguous key: CPF or phone.
  • qrCode: The QR Code to be paid
  • correlationID: A unique identifier for the payment.
  • comment: Comment attached to your payment when the transfer is made.
  • sourceAccountId: The source account ID. If not provided, the default account is used.

In practice, your request body would look like this example:

{
"value": 100,
"destinationAlias": "38763885700",
"destinationAliasType": "CPF",
"correlationID": "31ee9576-99ec-412a-9ac7-e142a4a6acf0",
"comment": "um comentário"
}

After making the request, if everything went well, the request status code will be 2xx and the response body will contain the information about the newly created payment.

For example, this will be our response:

{
"payment": {
"value": 100,
"status": "CREATED",
"destinationAlias": "c4249323-b4ca-43f2-8139-8232aab09b93",
"destinationAliasType": "RANDOM",
"comment": "payment comment",
"correlationID": "payment1",
"sourceAccountId": "my-source-account-id"
}
}