Home / Guides / Verify Stripe webhook signatures (Next.js, Supabase Edge Functions)

Verify Stripe webhook signatures (Next.js, Supabase Edge Functions)

Why an unsigned Stripe webhook lets anyone fake a payment, and how to verify the Stripe-Signature header correctly.

Check your live site

Run the free ShipLatch scan on your own site without leaving this page.

Uses 1 of your 3 free scans today; a site scanned in the last 24 hours answers from that scan. Passive and read-only: we only look at what any browser can see. Only check sites you own or may test.

What the free scan checks

  • Leaked keys in your live JavaScript (AI, payment and cloud keys), including a Supabase service_role key
  • Files that should never be public, like /.env and /.git
  • Supabase and Firebase secrets in the browser: an sb_secret_ key, a Supabase access token or a Firebase service-account file
  • HTTPS and security headers (CSP, HSTS, clickjacking protection)

It only reads what any visitor's browser can see. It doesn't log in, read your tables or check App Check.

If your webhook handler marks an order paid whenever a POST arrives, anyone who finds the URL can send a fake checkout.session.completed event and unlock your product for free. Stripe signs every webhook; your job is to check the signature before trusting the body.

What to check

How to test

Use the Stripe CLI: stripe listen --forward-to localhost:3000/api/stripe/webhook then stripe trigger checkout.session.completed. Then send the same endpoint a plain curl -X POST with a made-up JSON body. It must be rejected.

Copy-paste into your AI builder
Audit my Stripe webhook handler. Verify the Stripe-Signature header using the raw request body and the endpoint secret from a server-side env var (constructEvent in Node, constructEventAsync with SubtleCrypto on Deno/edge). Reject with 400 if verification fails, make processing idempotent by event id, and derive what was purchased from the Checkout Session on the server. Show the full diff.

Related: Pre-launch checklist · Hide API keys

Scan your app free

Paste your URL. ShipLatch checks for leaked keys, exposed /.env and /.git, and flags Supabase/Firebase so you know what to lock down. The free scan finds the issues; the $29 Fix Pack gives you fix prompts written for your app and re-scans that prove each fix worked.

Scan free at shiplatch.com → See the Fix Pack · $9 playbook

Want the whole pre-launch process in one place? See what's inside App Security for Vibe Coders, our $9 PDF playbook, or go straight to checkout.

More guides