E-commerce and payments
What is Webhook?
A webhook is an HTTP request a third-party service sends to your server when something happens — a payment succeeding, a subscription renewing, a refund being issued. It is the reliable place to fulfil an order, because it does not depend on the customer’s browser.
Also called: callback URL · HTTP callback
Why it matters more than the redirect
The common pattern in tutorials is to create the order when the customer returns to your success page. In production people close the tab, lose signal, or background the browser — and in a redirect-driven flow that customer has been charged with no order created.
A webhook arrives regardless. The browser redirect should display state; the webhook should create it.
The three things every handler needs
- Signature verification, so you only act on messages that genuinely came from the provider
- Idempotency — record the event id and make a repeat a no-op, because delivery is at-least-once
- A fast response. Do the minimum synchronously and queue the rest, or the provider times out and retries
The bug that appears one month later
Subscriptions fulfil on a different event from one-off orders. A handler that only listens for checkout completion works perfectly until the first renewal cycle, when nobody is watching any more.
Where this is covered in depth
A definition can only go so far. Stripe checkout integration, and the four failure modes nobody tests for covers this properly — 3 minutes, free, no email required.
Who wrote this
Anas Bin Masud builds e-commerce sites and does technical SEO for businesses in the UK, Canada and Pakistan. These definitions come from client work rather than from a content brief — where an entry describes a mistake, it is usually one found on a real site. More about how I work.