Short answer
A webhook is an HTTP request that one service sends to a URL of yours as soon as an event happens, for example Stripe telling your app that a payment succeeded. Instead of asking repeatedly, your app is told. Because the endpoint is public and its messages can change plans, credits or orders, a webhook handler must verify the sender, handle repeats and answer quickly.
Ask an AI about this page:ChatGPTClaude
On this page
A webhook is an HTTP request that one service sends to a URL you registered, as soon as a particular event happens. Instead of your app polling an API every few minutes to ask “anything new?”, the other service tells you. GitHub’s docs describe it as receiving data “as it happens”, and Stripe uses webhooks to report events such as a successful payment, a dispute or a renewed subscription.
Webhooks in an AI-built app
In a Lovable or Bolt app with payments, the Stripe webhook is often the most important piece of server code. Checkout happens on Stripe’s page; your app only learns that the customer paid when Stripe calls your webhook, usually a Supabase edge function, with an event like checkout.session.completed. The handler then marks the user as paid, adds credits or unlocks a plan.
Supabase can also send webhooks itself: Database Webhooks call a URL or an edge function whenever a row is inserted, updated or deleted.
Because the endpoint is a public URL that grants things of value, three properties matter:
| Property | Why | Wiki entry |
|---|---|---|
| Verified sender | Anyone can POST a fake “payment succeeded” event | Webhook signature |
| Safe to repeat | Providers retry and may deliver the same event twice | Idempotency |
| Fast answer | Stripe expects a 2xx quickly; slow handlers time out and get retried | – |
Edge functions that receive webhooks usually set verify_jwt = false, because Stripe does not send a Supabase token. Supabase’s docs allow that for webhooks only when the handler verifies the signature itself.
How to check your app
- Find every webhook handler: search for
stripe.webhooks,Stripe-Signature,webhookinsupabase/functions/and in your server routes. - Check that each one verifies the provider’s signature against the raw request body before it reads any field.
- Check that it records processed event IDs and skips repeats.
- Check that it takes the user or customer from trusted data (for example a customer ID you stored at checkout), not from a field anyone could put into a fake event.
- In the Stripe dashboard, subscribe the endpoint only to the event types you handle.
How to prevent problems
Verify, deduplicate, answer fast, and do slow work afterwards. The whole Stripe setup, from checkout to subscription changes, is in Stripe in vibe-coded apps. The two fixes that matter most are Stripe webhook without signature check and Non-idempotent Stripe webhook.
Frequently asked questions
What is the difference between a webhook and an API call?
With an API call your app asks a service for data. With a webhook the service calls your app when something happens. GitHub’s docs contrast this with polling, where you keep asking whether anything changed.
Can I trust the data in a webhook?
Only after you have verified its signature. Anyone can send a POST request to your webhook URL. Even then, some providers recommend fetching the current state of the object from their API before acting on it.
What happens if my webhook handler is down?
Most providers retry. Stripe retries live-mode events for up to three days with exponential backoff, so your handler will see the same event again and must cope with that.
Sources
- 1.About webhooks — GitHub Docs
- 2.Receive Stripe events in your webhook endpoint — Stripe Docs
- 3.Database Webhooks — Supabase Docs
- 4.Securing Edge Functions — Supabase Docs