Creating a payment link

To create a payment link, simply call the payment link endpoint.

POST /v3/paymentLinks
Check the complete reference of this endpoint.

{
  "name": "Book Sale",
  "description": "Any book for just BRL: 50.00",
  "value": 50.00,
  "billingType": "UNDEFINED",
  "chargeType": "DETACHED",
  "dueDateLimitDays": 10
}

In the example above, a new single charge of BRL 50 will be created each time a customer fills out this payment link. It will remain active until it is disabled or deleted.

It is also possible to create payment links for installment payments. In this case, you only need to inform the maximum number of installments available, and the customer will choose how they wish to make the payment.

POST /v3/paymentLinks
Check the complete reference of this endpoint.

{
  "billingType": "CREDIT_CARD",
  "chargeType": "INSTALLMENT",
  "name": "Electronics Sale",
  "description": "Any product in up to 10 installments of BRL 50.00",
  "value": 500.00,
  "maxInstallmentCount": 10,
  "notificationEnabled": false
}

In the example above, since we don't have BOLETO in the billingType, it was not necessary to inform the field dueDateLimitDays. We also set notificationEnabled to false, so customers who fill out this payment link will not have active notifications.

Similarly, it is also possible to create payment links that create subscriptions. Simply inform the chargeType as RECURRENT.

POST /v3/paymentLinks
Check the complete reference of this endpoint.

{
  "billingType": "CREDIT_CARD",
  "chargeType": "RECURRENT",
  "name": "Book Subscription",
  "description": "Receive a book every month for BRL: 50.00",
  "value": 50.00,
  "subscriptionCycle": "MONTHLY"
}

How to know if a payment link has been paid?

Every time a payment link is paid, you receive an event on the Webhook for Payments. In the returned JSON, you will have access to the paymentLink field with the ID of your payment link.

In the same JSON, you will have access to the customer with your customer's ID, and you can retrieve their data if needed using the endpoint "Retrieve a single customer".

Adding images to a payment link

You can add up to 5 images to a payment link, and you can do this by calling the endpoint below:

POST /v3/paymentLinks/{id}/images
Check the complete reference of this endpoint

You can define whether the image is the main one, with the main field being sent as true. The file upload must be done with the header Content-Type: multipart/form-data.

🚧

Customer duplication in payment links

At Asaas, it is possible to create customers with duplicated CPF/CNPJ. Through the payment link, as the customer is always created at the moment of generating the charge, if they already exist in Asaas, the customer will be registered again, appearing two or more times (depending on the number of times the charge was generated).