Security wikiPayments · Integrations

What is a webhook?

Also known as: webhook endpoint, event destination, callback URL, HTTP callback

A webhook is an HTTP request a service sends to your app when something happens, such as a paid invoice. How webhooks work in AI-built apps and what makes them safe.

By Tim GeithnerPublished 2 min read

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:

PropertyWhyWiki entry
Verified senderAnyone can POST a fake “payment succeeded” eventWebhook signature
Safe to repeatProviders retry and may deliver the same event twiceIdempotency
Fast answerStripe 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

  1. Find every webhook handler: search for stripe.webhooks, Stripe-Signature, webhook in supabase/functions/ and in your server routes.
  2. Check that each one verifies the provider’s signature against the raw request body before it reads any field.
  3. Check that it records processed event IDs and skips repeats.
  4. 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.
  5. 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. 1.About webhooks — GitHub Docs
  2. 2.Receive Stripe events in your webhook endpoint — Stripe Docs
  3. 3.Database Webhooks — Supabase Docs
  4. 4.Securing Edge Functions — Supabase Docs

Find this in your own app

ShipRely reads your repository (read-only), proves each finding with file and line, and gives you a fix prompt to paste into your AI builder.

Run a demo audit
  • Read-only access to your repository
  • Every finding with file and line
  • Fix prompts for Lovable, Cursor, Claude Code and Bolt