Anticipation events

Listen to Asaas events to keep your integration up to date.

Use anticipation events to automatically track the state changes of a receivables anticipation.

Each notification indicates the event that occurred in event and the current operation data in the anticipation object.

Available events

EventWhen it occurs
RECEIVABLE_ANTICIPATION_CANCELLEDThe anticipation is cancelled.
RECEIVABLE_ANTICIPATION_SCHEDULEDThe anticipation is scheduled.
RECEIVABLE_ANTICIPATION_PENDINGThe anticipation is under review.
RECEIVABLE_ANTICIPATION_CREDITEDThe anticipation is credited.
RECEIVABLE_ANTICIPATION_DEBITEDThe anticipation is debited.
RECEIVABLE_ANTICIPATION_DENIEDThe anticipation request is denied.
RECEIVABLE_ANTICIPATION_OVERDUEThe anticipation becomes overdue.

The events represent changes in the anticipation processing. Do not assume that every operation will go through all the events above or that they form a mandatory sequence.

How to interpret the events

EventHandling in the integration
RECEIVABLE_ANTICIPATION_SCHEDULEDKeep the operation as scheduled.
RECEIVABLE_ANTICIPATION_PENDINGIndicate that the anticipation is under review.
RECEIVABLE_ANTICIPATION_CREDITEDConfirm the anticipation credit in your system.
RECEIVABLE_ANTICIPATION_DEBITEDUpdate the operation to reflect the debit.
RECEIVABLE_ANTICIPATION_DENIEDMark the request as denied and check anticipation.denialObservation, when filled in.
RECEIVABLE_ANTICIPATION_CANCELLEDUpdate the operation as cancelled.
RECEIVABLE_ANTICIPATION_OVERDUEUpdate the operation to reflect that it is overdue.

event identifies the change notified by the Webhook. anticipation.status represents the current status of the anticipation in the payload.

Event payload

The notification is sent via POST with the event and the anticipation data.

{
  "id": "evt_05b708f961d739ea7eba7e4db318f621&368604920",
  "event": "RECEIVABLE_ANTICIPATION_CREDITED",
  "dateCreated": "2024-06-12 16:45:03",
  "account": {
    "id": "47ed0d25-f9fb-4b35-b23a-d8895caf92b7",
    "ownerId": null
  },
  "anticipation": {
    "object": "anticipation",
    "id": "29ad50e9-64ee-427e-a00c-a3999510ca0a",
    "installment": null,
    "payment": "pay_4310966350068380",
    "status": "CREDITED",
    "anticipationDate": "2022-09-19",
    "dueDate": "2022-09-30",
    "requestDate": "2022-09-19",
    "fee": 5.64,
    "anticipationDays": 11,
    "netValue": 302.37,
    "totalValue": 310,
    "value": 308.01,
    "denialObservation": null
  }
}

Important payload fields

FieldDescription
idUnique identifier of the event. Use it for idempotence.
eventIdentifies the event received.
anticipation.idAnticipation identifier.
anticipation.statusCurrent status of the anticipation.
anticipation.paymentCharge related to the anticipation, when applicable.
anticipation.installmentInstallment related to the anticipation, when applicable.
anticipation.netValueNet amount credited.
anticipation.totalValueGross amount of the anticipation.
anticipation.feeFee applied.
anticipation.denialObservationReason for the denial, when there is one.
👍

Webhook response with types and ENUMs

If you want to know the type of each field and the available ENUM values, check the 200 response of the "Retrieve a single anticipation" endpoint in the documentation.

How to handle the events

When receiving an anticipation event:

  1. identify the change through the event field;
  2. persist the id to prevent duplicate processing;
  3. use anticipation.id to find the anticipation in your system;
  4. update the operation according to the event and anticipation.status;
  5. respond HTTP 200 after confirming persistence;
  6. process additional rules asynchronously.

Webhooks follow the at least once model, so the same event may be sent more than once.

See how to implement idempotence in Webhooks.

To track the anticipation's state changes, prefer these events instead of periodically querying the API. Use the individual query only when you need to retrieve the current state of an operation on a one-off basis.

🚧

Attention

  • As new products and features are added to Asaas, new attributes may be included in the Webhook. It is very important that your code is prepared not to throw exceptions if Asaas returns new attributes that your application does not handle, as this may interrupt the sync queue.
  • We will send an email and announce on our Discord when new fields are added to the Webhook. The email will be sent to the notification email address defined in the Webhook settings.

Next steps


Did this page help you?