Introduction - Payments
Learn the step-by-step process for creating payments in Asaas.
Create and track payments
Payments record amounts receivable in the Asaas account and make payment methods available to your customers.
In this flow, your integration registers the customer, creates the payment, makes the payment available, and tracks its status through reconciliation.
ImportantBy the end of this guide, you will know how to create a payment, choose the payment method, and track the result through the API and Webhooks.
When to use
Use payments when your integration needs to generate an amount receivable for a customer registered in Asaas.
Some common scenarios are:
- one-off sales;
- billing for services rendered;
- monthly fees controlled by your application;
- transparent checkout;
- sending a hosted invoice;
- receiving payments by bank slip (boleto), Pix, or credit card.
To provide a page where the customer fills in their own details or chooses products and payment terms, see:
Before you start
To create a payment:
- register or look up the customer;
- store the ID returned in the
idfield; - define the payment method;
- define the amount;
- provide the due date;
- prepare status tracking.
The customer ID must be sent in the customer field when creating the payment.
How it works
Create or look up the customer
↓
Store the customer ID
↓
Create the payment
↓
Make the payment available
↓
Track the status
↓
Reconcile in the source system1. Register the customer
Before creating the payment, register the payer and store the ID returned by the API.
See the guide: Customer registration.
AttentionAsaas allows duplicate customers.
Reuse the ID stored by your application or look up existing customers before creating a new record.
2. Create the payment
Send a request to the payment creation endpoint.
The main fields are:
| Field | Purpose |
|---|---|
customer | Customer ID in Asaas |
billingType | Payment method |
value | Payment amount |
dueDate | Due date in YYYY-MM-DD format |
externalReference | Payment identifier in your system |
See the endpoint: Create new payment.
After creation, store the payment ID returned by the API. It will be needed for queries, updates, refunds, and reconciliation.
3. Choose the payment method
The payment's behavior depends on the value sent in billingType.
See the corresponding guide:
To let the customer choose the payment method on the Invoice, use the corresponding setting provided by the endpoint.
To split the amount into installments, see Create an installment payment.
4. Make the payment available
After creating the payment, your application can:
- use the returned URL to display the Invoice;
- send the Invoice to the customer;
- present the bank slip, Pix QR Code, or card form within your own flow;
- use a Payment Link;
- use Asaas Checkout.
| Experience | When to use |
|---|---|
| Payment Invoice | To use the payment page linked to an already created payment |
| Payment Link | To let the customer fill in their own details |
| Asaas Checkout | To direct the customer to a hosted page within a purchase flow |
To redirect the customer back to your application after payment, see Redirection after payment.
5. Track the status
After creation, track the payment to identify events such as:
- payment awaiting payment;
- payment confirmed or received;
- overdue payment;
- payment deleted or restored;
- refund;
- chargeback;
- card processing failure.
Use Webhooks to automatically receive changes that occur in the account.
To learn about the events related to the payment lifecycle, see Events for payments.
ImportantDo not rely only on the response to the creation request.
Some changes occur asynchronously and must be tracked via Webhooks or subsequent queries.
6. Reconcile the payment
When you receive an update:
- identify the payment by the
idfield; - find the corresponding record in your system;
- validate the new status;
- update the order, service, or internal balance;
- record the processing date and result.
Use externalReference to link the payment to an order, contract, or record in your application.
Implement idempotency to prevent the same event from being processed more than once.
Configure notifications
Asaas can send payment-related notifications through channels such as email, SMS, or WhatsApp, depending on availability and account settings.
Notifications may include:
- notice of payment creation;
- reminder before the due date;
- notice on the due date;
- overdue notice;
- reminders after the due date;
- update notice;
- sending of the bank slip digitable line.
RecommendedDefine your communication strategy before creating customers and payments, avoiding duplicate notifications between Asaas and your application.
Important considerations
- Store the customer and payment IDs.
- Use
externalReferenceto make reconciliation easier. - Validate the customer, amount, and due date before creation.
- Avoid duplicate payments on retries and reprocessing.
- Implement idempotency when processing Webhooks.
- Handle card failures and declines.
- Consider the due date and expiration rules for bank slips and Pix.
- Do not treat a created payment as a paid payment.
- Query the operation again when there is a timeout or an inconclusive response before repeating the creation.
Next steps
Updated 7 days ago
