On this page3 sections
ReferenceIntermediate4-6 min reference

Webhook Testing

A webhook is an outbound HTTP callback: the provider POSTs an event to your URL when something happens. They fail in ways normal request/response APIs don't — duplicates, retries, out-of-order delivery, replay attacks. This sheet is the checklist of properties to test; use the webhook payload tester utility (linked below) to capture and inspect payloads.

Properties to test

PropertyTestExpected
DeliveryTrigger the source eventEndpoint receives a POST
PayloadInspect body + headersMatches documented schema
SignatureTamper / wrong secretRejected; valid signature accepted
RetriesReturn 500/timeoutProvider retries with backoff
IdempotencySame event delivered twiceHandler processes it once
OrderingEvents arrive out of orderHandler tolerates / reorders
DuplicatesReplay an old eventDe-duplicated by event id
AckSlow handlerRespond 2xx fast, process async
Replay attackRe-send a captured requestRejected via timestamp/nonce

Status code contract

  • Respond 2xx quickly to acknowledge receipt — do the heavy work asynchronously.
  • A non-2xx (or timeout) tells the provider to retry, so a slow handler causes duplicate deliveries.
  • That's exactly why idempotency keys / event ids matter.

Common mistakes

  • Assuming exactly-once delivery — webhooks are at-least-once; design for duplicates.
  • Doing slow work before returning 2xx, triggering retries and duplicate processing.
  • Skipping signature verification, leaving the endpoint spoofable.
  • No replay protection (timestamp/nonce), so old captured events can be re-sent.
  • Testing only the happy delivery, never retries or out-of-order arrival.

// Related resources