AXTHORM

© AXTHORM

Developer library

Handle events and webhooks

Events can arrive more than once, late, or out of order. Design the receiving endpoint for replay.

Walkthrough

1. Verify the sender

Use the provider’s signature verifier with the raw request body.

2. Record and acknowledge

Persist the event ID, deduplicate it, and acknowledge after durable acceptance.

3. Process safely

Move slow work out of the handler and reconcile critical state against the provider.

Worked example

A payment notification arrives twice. Verify the signature first, then use a unique event ID in storage so only one job is accepted.

Open the example
SQL · deduplication
INSERT INTO webhook_inbox (event_id, received_at)
VALUES ($1, CURRENT_TIMESTAMP)
ON CONFLICT (event_id) DO NOTHING;

Try it yourself

A payment provider delivers the same verified event twice. What happens?