Webhooks and events
An event records a committed change to a resource. It names the resource in relatedObject, carries it in data.object and, for a status change, gives the transition.
You can read the events of the last 30 days with GET /events, or have them delivered to a webhook endpoint. The Events API reference lists every event type with an example.
Event data
Events recorded before resources were included have no data.
data.object never contains:
Full card numbers, CVVs and tokens are never in an event.
Register an endpoint
The response returns the endpoint’s signing secret, starting with whsec_, once. Store it now: reads never return it.
- The URL must use
httpson port 443, with no user name, password or fragment, and its host must resolve only to public internet addresses. - List each event type. There are no wildcards.
- The key needs
webhooks:write, plus the read permission of each event’s object, for examplecards:readfor card events. - A platform key that sends no
Account-Holdercreates an endpoint for the platform. - At most 16 endpoints can exist at once for an account holder or a platform.
- An endpoint keeps working when the API key that created it is rotated or revoked.
Receive deliveries
Each delivery is a POST of one event as JSON, with these headers:
Respond with any 2xx status within 15 seconds. A redirect, any other status, a timeout or a connection failure is a failed attempt. Failed deliveries are retried after about 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours, 12 hours, 24 hours and 24 hours, 9 attempts over about 3 days, then marked failed.
Deliveries are at least once and unordered. Handle each event once by its id.
data.object is the resource as of the event, not necessarily its current state. Compare createdAt with the newest event you applied for that resource. Read relatedObject.url, a path relative to your API host, when you need the current state or data.objectOmitted is true. A receiver that ignores data and reads relatedObject.url for every event keeps working.
Verify signatures
- Remove the
whsec_prefix from the secret and base64-decode the rest. The bytes are the HMAC key. - Build
<webhook-id>.<webhook-timestamp>.<raw request body>, using the body bytes exactly as received, before any JSON parsing. - Compute its HMAC-SHA256 and base64-encode it.
- Compare it in constant time with each
v1value inwebhook-signature. Accept the delivery when any one matches. - Reject the delivery when no value matches, or when
webhook-timestampis more than 300 seconds from your clock.
Test your code with these values. With the secret whsec_AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8=, webhook-id 6a0e9e0b-63b8-4d0e-9a8e-0f6f8c1b2d34, webhook-timestamp 1792000000 and the body {"id":"6a0e9e0b-63b8-4d0e-9a8e-0f6f8c1b2d34","object":"event","type":"card.frozen"}, the signature is v1,KEmTnkw6RcOo17Gh0FRB7W666CHeKFesBWSwMvXPOXk=.
Rotate the secret
POST /webhookEndpoints/{webhookEndpointId}/rotateSecret returns a new secret once. For 24 hours each delivery carries two signatures, one per secret, so deploy the new secret within that window.