Payments via bank slip
Payments are the main way to receive money in your Asaas account. With them, you can receive payments via Bank Slip, Credit Card, Debit Card, and Pix. This first guide will show you how to create a flow for bank slips. Learn more.
Creating a payment via bank slip
When creating a payment, a bank slip is automatically created. Remember that the fee related to the payment of a bank slip is only deducted from your account if it is paid.
POST
/v3/payments
Check the complete reference of this endpoint
{
"customer": "cus_000005219613",
"billingType": "BOLETO",
"value": 100.00,
"dueDate": "2023-07-21"
}
Looking at the returned object, we have access to the bankSlipUrl
property, which is the PDF file of the bank slip that has just been generated.
Installment payment
You can also easily create an installment payment and retrieve the installment book for this payment with all the bank slips.
First, let's create our installment payment in 10 installments.
POST
/v3/payments
Check the complete reference of this endpoint
{
"customer": "cus_000005219613",
"billingType": "BOLETO",
"value": 2000.00,
"dueDate": "2023-07-21",
"installmentCount": 10,
"installmentValue": 200.00
}
In the response from the API, we can see that the installment
field was filled with the installment ID: 24ef7e81-7961-41b7-bd28-90e25ad2c3d7
.
Payment booklet
To generate the payment booklet, you just need to make a GET
call to the following endpoint:
GET
/v3/installments/24ef7e81-7961-41b7-bd28-90e25ad2c3d7/paymentBook
Check the complete reference of this endpoint
Note that the installment ID that we just received upon creation is used here, this endpoint returns a PDF file with all the generated bank slips.
Bank slip with early payment discounts
To have Asaas payment interest and fines when a bank slip is paid late, you must specify this when creating the payment. For example, if you want to give a 10% discount for payment 5 days before the due date, just send the payment creation like this:
POST
/v3/payments
Check the complete reference of this endpoint
{
"customer": "cus_000005219613",
"billingType": "BOLETO",
"value": 2000.00,
"dueDate": "2023-07-21",
"discount": {
"value": 10,
"dueDateLimitDays": 5,
"type": "PERCENTAGE"
}
After the payment is paid, if you search for it, you will see that there will be an originalValue
field, indicating that the value
field is different from the originally defined value. This information will also be present in the Webhook return.
Bank slip with interest and fines
Just as you can add discounts for early payments, you can define interest and fines for late payments.
POST
/v3/payments
Check the complete reference of this endpoint
{
"customer": "cus_000005219613",
"billingType": "BOLETO",
"value": 2000.00,
"dueDate": "2023-07-21",
"interest": {
"value": 1,
},
"fine": {
"value": 2,
},
}
This will add 1% interest per month and a 2% fine in case of delay. The same information about originalValue
applies here too.
After the bank slip is paid, in the Webhook return, you will have access to the
interestValue
field, which shows the sum of the interest and fines that were applied to the payment.
Getting the bank slip's digitable line
If you need the digitable line to display to your customer, a new API call is required.
GET
/v3/payments/{id}/identificationField
Check the complete reference of this endpoint
{
"identificationField": "00190000090275928800021932978170187890000005000",
"nossoNumero": "6543",
"barCode": "00191878900000050000000002759288002193297817"
}
If the payment is updated, the digitable line will also change. It is advised that every time the payment is updated, the digitable line is retrieved again, ensuring that you are always displaying the updated digitable line.
How to add the Pix QRCode to the bank slip PDF?
For a Pix QRCode to appear on all bank slip PDFs generated by Asaas, you just need to have registered a Pix key on your account.
API Reference
Check the complete reference of the Payments endpoint (
/v3/payments
)
Updated 8 months ago