Asynchronous Events

The most important information for integrators are the event messages sent via webhooks during changes of the transaction lifecycle. These events are sent to the WebhookURL informed on any payment request.


Payments Webhook Event Payload

The event payload contains a set of attributes that represent the current state of the origin transaction, as presented in the example bellow, that represents a transaction that was just completed.

{
  "id": "4494a26c-4f21-400a-bbe7-cbef6ea7c3c3",
  "transactionState": "Completed",
  "transactionDate": "2023-08-04T14:45:39.150Z",
  "transactionOrderId": "in-1414870875-158709817091784",
  "transactionOrderDescription": "This is a test order.",
  "transactionReceipt": "https://api.sandbox.pagfast.com/v1/system/e-receipt/4494a26c-4f21-400a-bbe7-cbef6ea7c3c3/receipt.pdf", 
  "transactionReceiptDate": "2023-08-04T14:45:39.047Z",
  "transactionReceiptVoucher": "D6BE9C802C7846029269C485FE23060C",
  "transactionAmount": "50.000000",
  "transactionType": "Credit",
  "transactionPaymentType": "PIX",
  "stateRegisteredDate": "2023-08-04T14:45:34.332Z",
  "stateCompletedDate": "2023-08-04T14:45:39.150Z",
  "stateCancelledDate": null,
  "stateRefundDate": null,
  "stateReversedDate": null,
  "stateErrorDate": null,
  "stateErrorCause": null,
  "webhookUrl": "https://postman-echo.com/post?test=1",
  "payer": {
    "name": "CRISTINA INACIO OLIVEIRA DA CONCEICAO",
    "taxNumber": "14435549603",
    "bankCode": "999",
    "bankName": null,
    "accountAgency": "99999",
    "accountNumber": "99999",
    "accountDigit": "9"
  },
  "recipient": {
    "name": "Pagfast Cobrança e Serviço em Tecnologia Ltda",
    "taxNumber": "46261360000148",
    "bankCode": "999",
    "bankName": "SANDBOX",
    "accountAgency": "99999",
    "accountNumber": "99999",
    "accountDigit": "9"
  }
}

A detailed description is presented next.

Field NameTypeTransaction StateDescription
idstringAll StatesAn UID that uniquely identifies the event
transactionStatestringAll StatesThe current transaction state as one of: Registered, Cancelled, Completed, Reversed or Error
transactionDatestringAll StatesThe transaction request date
transactionOrderIdstringAll StatesThe order identification sent by the integrator during the transaction request
transactionReceiptstringCompletedThe transaction receipt URL, once this webhook notifies a complete transaction
transactionReceiptDatestringCompletedThe payment receipt issue date
transactionReceiptVoucherstringCompletedA payment code provided by the Bank of Emission.
transactionAmountstringAll StatesThe value of the origin transaction
transactionChargesstringCompletedThe changes applicable to the transaction
transactionTypestringAll StatesTransaction Type, Credit for Cash In, or Debit for Cash Out
transactionPaymentTypestringAll StatesPayment type (e.g. PIX).
stateRegisteredDatestringAll StatesThe date for the intermediary state when the transaction is registered with the bank
stateCancelledDatestringCanceledThe date of a transaction canceling if the transaction state is Canceled. Empty otherwise
stateCompletedDatestringCompletedThe date of a transaction completion if the transaction state is Completed. Empty otherwise
stateRefundDatestringNoneThe date of a transaction refund if the transaction state is Refunded. Empty otherwise.
Note: Refund state is included in the API but can not be reached. If you have doubts, please read the discussion about refunds in the transaction lifecycle section.
stateReversedDatestringReversedThe date of a transaction rollback if the transaction state is Reversed. Empty otherwise.
Note: Rollback state only applies to transactions in intermediate states, not transactions in final state.
stateErrorDatestringErrorThe date of a transaction error if the transaction state is Error. Empty otherwise
stateErrorCausestringErrorA key for an error description if the state is Error. Empty otherwise.
For a full list of errors, please refer to our Errors Identifiers in the Platform Errors guide.
webhookUrlstringAll StatesThe Webhook notification URL
payer.namestringCompletedThe account owner name
payer.taxNumberstringCompletedThe account owner document number
payer.bankCodestringCompletedThe payer bank code as defined by the Central Bank authority in Brazil
payer.bankIspbstringCompletedA payer six-digit code used to uniquely identify payment institutions in Brazil (if available)
payer.bankNamestringCompletedThe payer institution name (if available)
payer.accountAgencystringCompletedThe payer bank account agency (if available)
payer.accountNumberstringCompletedThe payer bank account number (if available)
payer.accountDigitstringCompletedThe payer bank account verification digit (if available)
payer.accountTypestringCompletedA text with one of the following: CheckingAccount, SavingsAccount or SalaryAccount (if available)
recipient.namestringCompletedThe recipient account owner name
recipient.taxNumberstringCompletedThe account owner document number
recipient.bankCodestringCompletedThe recipient bank code as defined by the Central Bank authority in Brazil
recipient.bankIspbstringCompletedThe recipient six-digit code used to uniquely identify payment institutions in Brazil (if available)
recipient.bankNamestringCompletedThe recipient institution name (if available)
recipient.accountAgencystringCompletedThe recipient bank agency (if available)
recipient.accountNumberstringCompletedThe recipient bank account number (if available)
recipient.accountDigitstringCompletedThe recipient bank account verification digit (if available)
recipient.accountTypestringCompletedA text with one of the following: CheckingAccount, SavingsAccount or SalaryAccount (if available)

Observation: Failures in the notification delivery trigger backoff retries, active during a 24-hour window. During this period, or after that, integrators can also manually resend the webhook events using the Administrative Portal if desired.

Table of Retries for Webhooks Notifications

RetryInterval
11 min e 25 s
24 min e 15 s
39 min e 55 s
421 min e 15 s
543 min e 55 s
61h 30 min
73h
86h
912h
1024h

Finally, in the API documentation we present webhook payloads examples for each transaction state.