Paying Boletos and Bills
Avaliable providers
These are the Providers that execute the functions of this feature.
ASSET | Provider | Status |
---|---|---|
BRLD | Dock | deprecated |
BRLB | BS2 | deprecated |
BRLP | Celcoin | avaliable |
Paying a Boleto and Bills
In Bit Capital's Platform, we give the ability for consumers to pay Bills and Boletos using their account, the flow is basically like this:
-
- First you need to get the boleto informations before paying it. This request gets the
barCode
sent by you and retrieves informations about this bill or Boleto (the system already checks if it's one or the other and does the correct flow automatically). You can do that using the validate endpoint sending the bar code:
- First you need to get the boleto informations before paying it. This request gets the
-
- Second you should pay the boleto sending the correct fields like described below.
curl --location --request POST 'https://nightly.btcore.app/boletos/emit' \
--header 'Authorization: Bearer TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"destination": "1f1aa63c-a5a0-4634-afd6-9e66bc6cb0dc",
"asset": "BRLP",
"provider": "bs2",
"amount": "10.11",
"expiresAt": "2021-10-13",
"payer": {
"firstName": "Name of Third Person",
"lastName": "Da Silva",
"consumer": {
"phones": [
{
"code": "11",
"number": "888999555"
}
],
"taxId": "12345678899",
"email": "[email protected]",
"addresses": [
{
"code": "06414007",
"state": "SP",
"street": "Avenida Sebastiap",
"neighborhood": "Jardim Tupanci",
"city": "Barueri",
"number": "1200"
}
]
}
}
}'
{
"destination": "1f1aa63c-a5a0-4634-afd6-9e66bc6cb0dc", //walletID to receive the amounts
"asset": "BRLP",
"provider": "bs2",
"amount": "10.11",
"expiresAt": "2021-10-13",
"payer": { //who will pay the Boleto
"firstName": "Name of Third Person",
"lastName": "Da Silva",
"consumer": {
"phones": [
{
"code": "11",
"number": "888999555"
}
],
"taxId": "12345678899",
"email": "[email protected]",
"addresses": [
{
"code": "06414007",
"state": "SP",
"street": "Avenida Sebastiap",
"neighborhood": "Jardim Tupanci",
"city": "Barueri",
"number": "1200"
}
]
}
}
}
If you're using the BRLD integration for paying bills, the amount to be paid may change in case of early payment discount or may even be added to a fine and interest in case of delay. Thus it is recommended to consult the updated value, as shown below.
If you're using the Celcoin(BRLP) integration, you'll see a response like this one:
{
"assignor": "BANCO BRADESCO S.A.",
"registerData": {
"documentRecipient": "02.333.212/0001-76",
"documentPayer": "012.345.678=90",
"payDueDate": "2020-06-02T00:00:00",
"nextBusinessDay": null,
"dueDateRegister": "2020-04-03T00:00:00",
"allowChangeValue": false,
"recipient": "Company LTDA",
"payer": "ESTEVAM PEREIRA GARCIA",
"discountValue": 0.0,
"interestValueCalculated": 0.0,
"maxValue": 1.0,
"minValue": 1.0,
"fineValueCalculated": 0.0,
"originalValue": 1.0,
"totalUpdated": 1.0,
"totalWithDiscount": 0.0,
"totalWithAdditional": 0.0
},
"settleDate": "25/05/2020",
"dueDate": "2020-04-03T00:00:00Z",
"endHour": "23:00",
"initeHour": "07:00",
"nextSettle": "N",
"digitable": "23793391009010800006928000767401582140000000100",
"transactionId": 3760845,
"type": 2,
"value": 1.0,
"maxValue": null,
"minValue": null,
"errorCode": "000",
"message": null,
"status": 0
}
Here we have a table explaining a little more some of the fields in the validation result:
Field | Description |
---|---|
registerData | Fields that were found in the CIP registry for this Boleto. |
registerData.documentRecipient | TaxId of the recipient of the Boleto. |
registerData.documentPayer | TaxId of the payer of the Boleto. |
registerData.recipient | The recipient's name of the Boleto |
registerData.payer | The Boleto's registered payer name. |
registerData.allowChangeValue | If true, the Boleto accepts payments of any value |
registerData.originalValue | The original value of the Boleto before interests, taxes, and discounts |
registerData.discountValue | The discount value of the Boleto |
registerData.interestValueCalculated | The interests value calculated |
registerData.maxValue | The max value this boleto accepts payments |
registerData.minValue | The minimum amount that is accepted in this Boleto. |
value | The total amount of the Boleto to be paid. |
type | Indicates if this is a Boleto or a Bill Payment |
status | The status of this Boleto |
As a result of successful payment execution a transaction of type boleto will be created and recorded on the Stellar blockchain and the account balance updated, the transaction should look like this:
{
"payments": [
{
"status": "authorized",
"type": "boleto",
"destination": {
"id": "c6628b29-1a9f-4c42-bedf-9982781fdf6e",
"root": true,
"stellar": {
"publicKey": "GBUWHPQWFMFSZJS3A3SKRBQRGLD257G3T7EAQGIL5GQIM67ZJKVKXGIN"
},
"updatedAt": "2020-03-16T22:34:03.997Z",
"createdAt": "2020-03-16T22:34:03.997Z"
},
"amount": "2",
"asset": {
"id": "a767bd7e-79f7-446e-bafe-ab10e4c61bb1",
"name": "BRL Celcoin",
"code": "BRLN",
"root": false,
"provider": "celcoin-provider",
"updatedAt": "2020-04-23T17:55:14.453Z",
"createdAt": "2020-04-23T17:55:14.453Z"
},
"scheduleFor": null,
"updatedAt": "2020-04-23T23:23:26.556Z",
"createdAt": "2020-04-23T23:23:26.556Z",
"id": "f347f810-0d59-480c-8a93-be8a6cb0cef2"
}
],
"source": {
"id": "df36a3b8-079e-44e0-8714-1c4b4f92e972",
"stellar": {
"publicKey": "GCGONO74APLIILAFIPG5NP4DVOVUIIHRT6CIMMOUGZDTTPNCXZ2WSU2Y"
},
"updatedAt": "2020-03-16T22:34:04.514Z",
"createdAt": "2020-03-16T22:34:04.514Z"
},
"states": [
{
"additionalData": {
"authorized": [],
"skipped": [
{
"provider": "celcoin-provider",
"payment": "f347f810-0d59-480c-8a93-be8a6cb0cef2",
"asset": "BRLN"
}
]
},
"updatedAt": "2020-04-23T23:23:26.692Z",
"createdAt": "2020-04-23T23:23:26.692Z",
"status": "AUTHORIZED",
"id": "0ee4857f-c566-418c-a864-2d94a9a6ec2f"
},
{
"additionalData": {},
"updatedAt": "2020-04-23T23:23:26.550Z",
"createdAt": "2020-04-23T23:23:26.550Z",
"status": "pending",
"id": "ee134409-e346-43b0-972b-46ada79127e3"
}
],
"updatedAt": "2020-04-23T23:23:26.542Z",
"createdAt": "2020-04-23T23:23:26.542Z",
"additionalData": {},
"status": "AUTHORIZED",
"type": "payment",
"id": "31dd4035-884c-4875-b14f-722fb478525e"
}
Updated about 3 years ago