Glossary

What Is a Webhook?

A webhook is an HTTP callback that an external service sends to your server when something happens — a payment succeeds, a form is submitted, a subscription changes.

Webhooks are the opposite of polling. Instead of your app asking "did anything change?" on an interval, the external service pushes an event to your app the moment it happens.

How webhooks work:

  1. You register a webhook URL on the external service (e.g. Stripe dashboard)
  2. The service sends a POST request to your URL when an event occurs
  3. Your server processes the event and updates its database
  4. You return a 200 response to acknowledge receipt

The most important webhook you'll build: Stripe webhooks. Never rely on the client redirect after checkout — it's unreliable. Instead, Stripe sends payment_intent.succeeded to your webhook handler, and that's where you update subscription status in your database.

Security — always verify the signature:

const event = stripe.webhooks.constructEvent(
  rawBody,
  req.headers['stripe-signature'],
  process.env.STRIPE_WEBHOOK_SECRET
);

Without signature verification, anyone can hit your webhook endpoint with fake events.

Retry logic: Webhook delivery isn't guaranteed. Every webhook handler should be idempotent — processing the same event twice should produce the same result.

Related Terms

Want this built?