Webhook
An HTTP request one system sends to another when something happens, instead of the other system asking repeatedly.
A webhook is an HTTP request one system sends to another when something happens, such as a payment succeeding, instead of the other system asking repeatedly. The receiver publishes a URL, and the sender calls it with the details of the event.
A payment provider calls your URL when a payment succeeds; a form tool calls it when someone submits. Webhooks arrive late, twice or out of order, and anyone who knows the URL can send one. A solid receiver verifies the signature, stores the event, answers quickly and does the real work in the background. Senders retry failed deliveries, which is where duplicates come from (at-least-once delivery). Stripe’s webhook docs are a good reference for signatures and retries, and Standard Webhooks is an open specification of the same conventions.
Treat each event as a message: verify it, store it with the inbox pattern, process it idempotently and check the payload with runtime validation. Events that keep failing belong in a dead-letter queue, where someone can see them. Polling an API on a schedule is the fallback when a provider offers no webhooks, and a useful safety net for events a webhook missed.
Sources
- Stripe: Receive Stripe events in your webhook endpoint docs.stripe.com
- Standard Webhooks: Standard Webhooks standardwebhooks.com
Related terms
- Idempotency (idempotency key): An operation is idempotent if doing it twice has the same effect as doing it once. Retries become safe.
- Inbox pattern (idempotent consumer): A consumer records the id of each processed message in the same transaction as its own change, and skips any id it has already seen.
- Runtime validation (Zod): Checking at run time that data from outside (requests, APIs, files, models) matches the type your code assumes.
- KSeF (Polish National e-Invoice System): Poland’s central system for structured e-invoices: invoices are sent as FA(3) XML and receive a KSeF number.
- At-least-once delivery: A queue or broker guarantee that every message arrives, possibly more than once, so consumers must handle duplicates.
- Dead letter queue (DLQ): A separate queue where messages land after failing processing too many times, so they are kept instead of lost or retried forever.
- Authoritative server (netcode): In multiplayer games, the server decides the true game state; clients only send inputs and predict what will happen.
