Webhooks
How the platform tells your server about every state change, and how to verify the message.
Every state change of a charge or of a refund, starting with its creation, records an event, and every event is delivered by HTTP POST to each destination registered in the environment. This is how your server learns that a PIX was paid, or that a refund reached the payer, without polling the API.
Events
- Every event has an identifier that starts with
evt_. - The event is recorded in the same database transaction that changes the state. There is no state change without an event, and no event without the change.
- The event types of a charge are
charge.created,charge.paid,charge.expired,charge.refunded,charge.dispute.createdandcharge.dispute.closed: see Disputes for the last two. The ones of a refund arerefund.created,refund.succeededandrefund.failed: see Refunds. Answer2xxto an unknown type and ignore it: the list grows. - Each type is an entry in the
webhookssection of the OpenAPI contract, with the body and the headers of the request.
The body
The body is small on purpose. It says what happened, when, and to which charge or refund:
{
"type": "charge.paid",
"timestamp": "2026-11-26T15:04:05.123456Z",
"data": { "id": "chg_01h455vb4pex5vsknk084sn02q" }
}| Member | Content |
|---|---|
type | The event type, the same as the name of the webhook in the contract |
timestamp | When the event happened, which is not when this attempt was sent |
data.id | The id of the charge, in a charge. event, or of the refund, in a refund. event |
The event carries no other data of the charge or of the refund. Read it with getCharge or getRefund to see its current state: by the time a delivery arrives, it may already have changed again. The body may gain members, so ignore the ones you do not know.
Destinations
A destination is a URL of yours that receives the events of one environment. Each destination has its own secret.
A destination is registered in the dashboard, in Webhooks, under the mode it is for. The dashboard shows its secret once, when the destination is registered. Registering and removing a destination ask for your passkey again when you signed in more than 5 minutes ago.
| Rule | Consequence |
|---|---|
The destination must be an https:// address | Any other scheme is refused when the destination is registered |
| An environment holds at most 16 destinations | Registering another is refused until one is removed |
| The destination must be a public address | A delivery to an address in a private network fails, even when a public name points to it |
| The destination must answer directly | Redirects are not followed |
Verifying the signature
Deliveries follow the Standard Webhooks specification. Every request carries three headers:
| Header | Content |
|---|---|
webhook-id | The id of the event, which starts with evt_. It stays the same on every retry |
webhook-timestamp | When this attempt was sent, in seconds since the Unix epoch |
webhook-signature | The signature, as v1,<base64> |
The signature is the HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{body}, encoded in base64. The secret starts with whsec_, and the HMAC key is the rest of the secret, decoded from base64.
To verify a delivery:
- Use the raw body, byte for byte as received. Parsing and serializing the JSON again changes the bytes and breaks the signature.
- Refuse a
webhook-timestamptoo far from the current time. This blocks replays. - Compute the signature and compare it with a constant-time comparison.
Prefer a Standard Webhooks library over writing this by hand. The project publishes reference libraries for Python, JavaScript, Java, Go, Ruby, PHP, C#, Rust and Elixir.
Retries and duplicates
- A delivery succeeds when your server answers with a
2xxstatus. Any other answer is a failure, and so is a redirect, or no answer within 15 seconds. - A failed delivery is tried again after 5 s, 5 min, 30 min, 2 h, 5 h, 10 h, 14 h, 20 h and 24 h. Each wait can be up to a tenth longer. That is ten attempts over a little more than three days.
- After the last attempt the event is dropped for that destination. The destination stays registered and keeps receiving the next events.
- A destination removed while a delivery was waiting does not receive it.
- The same event can therefore arrive more than once. Store the
webhook-idand ignore a repeated one. Otherwise an order may be fulfilled twice. - Events can arrive out of order. The
timestampof the body says when each one happened.