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
INSERT INTO webhook_inbox (event_id, received_at)
VALUES ($1, CURRENT_TIMESTAMP)
ON CONFLICT (event_id) DO NOTHING;