Verifying webhooks
Outbound webhooks (like checkout_session.succeeded) are signed with
HMAC-SHA256 over timestamp.payload, carried in the Transxact-Signature
header. Verify this signature before trusting a webhook body — otherwise
anything that can reach your endpoint’s URL can forge a fake payment
notification.
Add endpoints, reveal their signing secrets and send a signed webhook.test
event from the Webhooks section of your dashboard (Business accounts
only). Endpoints must be https://.
Several endpoints
You can add up to five endpoints for each mode, for example a staging server
beside production, or an accounting tool that only wants paid events. Each
endpoint has its own URL, its own signing secret, the events it wants, and an
on/off switch. A Test mode endpoint only hears Test mode events and a Live
mode endpoint only hears Live mode ones; the mode field on the Checkout
Session in the payload says which.
An event is sent to every endpoint that wants it, each as its own delivery
with its own id (evt_…), signed with that endpoint’s secret. Verify each
request with the secret of the endpoint it was sent to.
Rotating a secret replaces it at once, with no overlap. To change over without a gap, add a second endpoint with the new secret, move your traffic across, then delete the old one.
Verification also rejects any request where the signed timestamp is more
than 5 minutes old. The HMAC signature itself never expires on its own, so
without this tolerance window a captured valid webhook call would be
replayable indefinitely.
With the Node SDK
@transxact/node/webhooks exports verifyWebhookSignature, which does all
of the below, including the 5-minute check:
With the PHP SDK
transxact/transxact has the same check, with the same 5-minute window, as
Transxact\Webhooks::verifySignature:
Verifying manually
The Transxact-Signature header carries t=<timestamp>,v1=<hmac>, where
timestamp is milliseconds since epoch and hmac is the hex-encoded
HMAC-SHA256 of `${timestamp}.${rawPayload}` using your webhook signing
secret (from the dashboard’s Webhooks section):
Always pass the raw request body, exactly as received — re-serializing JSON before verifying can change byte-for-byte content and produce a signature mismatch even for a genuine webhook.
Receiving webhooks while you develop
Endpoints must be public https:// URLs, so a server on localhost can’t
receive them directly. Run a tunnel, such as
cloudflared tunnel --url http://localhost:3000 or ngrok http 3000, add its
https:// address as an endpoint, and press Send test to check
the whole path before you take a test payment.
Retries and duplicate events
Every event carries an id (evt_…). Answer with any 2xx status to
acknowledge it. Anything else, or no answer within 10 seconds, and we retry
the same event, with the same id, after 15 minutes, then 45 minutes, 2, 3,
6 and 12 hours — about a day in all — before giving up.
Delivery is at least once: a retry or a manual resend can reach you more than
once, so record the ids you’ve handled and skip repeats. Each retry is
signed afresh, so its timestamp is always current.
The Webhooks section of your dashboard lists recent deliveries, which endpoint each went to, whether it got them, and has a Resend button for sending one again straight away. A resend goes to that delivery’s own endpoint. If an endpoint is switched off or deleted when a retry comes, the delivery ends as failed without a request; switch the endpoint back on and resend it.