Guides
Webhooks

Webhooks

The unsigned deposit and payment webhook payloads and how to handle them.

Pay4Fun notifies you when an intent reaches a final status. The deposit webhook goes to the deposit intent's webhookUrl; the payment webhook, to the payment intent's callBackUrl (or webhookUrl). There is no global webhook registration.

Each notification is a POST with Content-Type: application/json.

GO 2.0 webhooks have no signature, HMAC or token. There is no way to prove the request came from Pay4Fun. Treat the webhook as a trigger ("something changed, go check") and confirm the status with a GET before releasing anything.

Deposit webhook

Sent when the deposit is approved (Success), refused by the bank (Rejected), failed by Pay4Fun's validation (FAILED) or returned (RETURNED). Mind the capitalization: it is not a uniform enum.

json
{
  "id": "596a71a0-72de-4f09-8b5f-05b0e9230adc",
  "externalId": "deposito-456",
  "status": "Success",
  "deposit": {
    "id": "c87b5495-ae90-4a24-8ae4-fe9fa326e459",
    "method": "Pix-QrDynamic",
    "status": "Success",
    "endToEndId": "E60746948202610230117mDeBJvX51cI",
    "amountOriginal": "200.00",
    "amountConverted": "200.00",
    "currencyOriginal": "BRL",
    "currencyConverted": "BRL",
    "payer": {
      "document": "12345678909",
      "name": "Ana Souza",
      "birthdate": "1900-01-01",
      "branch": "0001",
      "account": "123456",
      "accountType": "CC",
      "pspId": "60746948",
      "pspName": "Banco Bradesco S.A."
    }
  },
  "createdAt": "2026-10-23T01:17:19Z",
  "processedAt": "2026-10-23T01:17:19Z"
}
  • id is the intent; deposit.id is the deposit inside it.
  • Amounts are strings in the "0.00" format.
  • payer may be missing entirely, depending on the ShowPayerData flag. birthdate is a fixed value, not the payer's real date of birth: don't use it for any check.
  • RETURNED carries originalEndToEnd (the original Pix) and, in endToEndId, the refund id.
  • FAILED and Rejected carry deposit.error with {code, description} (for example DEP-114 "Pagador reprovado no screening" or AM02).

Expiry

When a Pix-QrDynamic expires unpaid, a separate notification arrives, without payer, with deposit.status: "Expired". The root status is the intent's after the expiry: Expired, or Pending if other methods are still open. Here createdAt is the intent's creation and processedAt the moment of expiry; deposit.endToEndId is null.

Payment webhook

Sent when the payment is released (Released) or refused (Declined).

json
{
  "id": "97ff299f-ea81-467c-9c6f-9abb6968cb9b",
  "externalId": "pedido-123",
  "status": "Released",
  "amount": 150,
  "createdAt": "2026-10-23T01:17:33Z",
  "timestampUTC": "2026-10-23T01:17:37Z",
  "currency": "BRL",
  "payment": {
    "method": "Pix-Key",
    "endToEndId": "E29079725202610230117Dur2utScejU",
    "data": { "branch": "0001", "account": "404428", "bankISPB": null, "document": "37065435000124", "accountType": "PAYMENT" }
  },
  "receiver": {
    "document": "35795854875",
    "name": "Recebedor de Teste",
    "branch": "0001",
    "account": "289783",
    "pspId": "18236120",
    "pspName": "Nu Pagamentos S.A. - Instituição de Pagamento"
  },
  "error": null
}
  • amount is a number (in the deposit webhook it is a string) and currency is always BRL.
  • payment.data is the data of whoever sent the Pix (your account). On Released, bankISPB is null; on Declined, it is filled.
  • receiver may come with every field null, depending on the ShowReceiverData flag.
  • On Declined, error carries {code, description}, for example {"code": "AC03", "description": "Conta do recebedor inexistente ou inválida"}.

How to handle them

  • Answer quickly with any 2xx; the response body is ignored.
  • Deduplicate by id (or externalId) + status: on a redelivery you may get the same notification more than once.
  • Treat optional fields as possibly missing or null.
  • With no URL on the intent, nothing is sent: no error, just silence.

Failures and redeliveries are covered in Retries.

See the notifications in Mimicr

Every notification is recorded, including those with no URL. Through the control API:

bash
curl --url 'https://api.mimicr.dev/v1/pay4fun/deliveries?kind=deposit&event=Success' \
  --header 'Authorization: Bearer mk_...'

event is the webhook status (Success, Rejected, FAILED, RETURNED, Expired, Released, Declined) and ref is the intent id. To wait for a notification in a test: npx mimicr wait pay4fun delivery kind=payment event=Released ref=<intent-id>. The console also sends a sample webhook to any URL you choose.