Short, sourced fixes for the bugs that make customers pay and not get access. Every claim links to the official docs.
Why Stripe events never reach your app (redirects, auth walls, wrong secret, slow handlers) and how to confirm each one in minutes.
If buyers pay through Stripe Checkout but your app never unlocks, fulfillment is probably tied to the success page or a failing webhook. Here's the fix.
Stripe says this error means the raw body, the Stripe-Signature header or the whsec_ secret is wrong. Fixes with code for Next.js, Express and Supabase.
A 307 or 308 in your Stripe event deliveries means the URL redirects (www, https or trailing slash). Stripe counts redirects as failed deliveries. Use the final URL.
If your Lovable or Bolt app uses Supabase Edge Functions for Stripe, 401 errors mean JWT verification is on, and signature errors need constructEventAsync.
Stripe webhooks to a Supabase Edge Function fail with 401 when the built-in JWT check is on. Turn it off for that function and verify the Stripe signature instead.
Stripe needs the raw request body to verify webhooks. In the App Router use await req.text(); in the Pages Router set bodyParser: false and read a buffer. Working code.
Vercel Deployment Protection puts preview (and sometimes production) URLs behind a login Stripe cannot pass. Use the production domain or Protection Bypass for Automation.
Going live with the test whsec_ (or the Stripe CLI secret) makes every real payment fail verification. How to spot it and switch safely.
Stripe can deliver the same event more than once and in any order. Store event IDs, check session state, and make fulfillment safe to repeat.
If your webhook doesn't verify the Stripe-Signature header, anyone with the URL can post a fake checkout.session.completed and unlock your product.
Stripe shows the subscription active, upgraded or canceled, but your database still has the old status. The events to handle, the ID to store, and how to resync.
Stripe deliveries fail with a 403 or 302 and your code never runs? Cloudflare Bot Fight Mode, a challenge rule or Cloudflare Access is answering first. Find which one and exempt only the webhook.
A Stripe webhook can fail for days while payments still go through. Check endpoint status, list failed deliveries with delivery_success=false, and set up a daily alert.
Stripe rejects webhooks whose signed t= timestamp is more than 300 seconds old. Causes (clock drift, verifying late, replayed payloads), fixes, and why tolerance 0 disables the check.
Moved your app to a new host or domain and payments stopped unlocking? Stripe keeps sending to the old URL. How to repoint the endpoint, keep the right signing secret, and recover missed events.
Stripe shows (Timed out) ERR or a 500 and retries pile up? Your handler does too much before it answers. Record the event, return 2xx, and finish the work after the response without losing it.
The customer got a refund, opened a chargeback or canceled, and still has full access. Your webhook only listens for the purchase. The events to add and how to map them back to the user.
You changed the handler and now you are waiting for a real customer to find out if it works. Resend the event that failed, replay it locally, or trigger a fresh test event in minutes.
If your app grants access when the buyer lands on /success, anyone who types that URL gets it free. Check the Checkout Session on your server, tie it to the user, and let the webhook do the unlocking.
If your frontend sends the amount to your checkout endpoint, anyone can edit it and pay $1 for your $49 plan. Send a Price ID, look it up on the server, and check what was paid before you unlock.
A buyer clicks Pay twice, or subscribes twice, and your server happily creates two payments. Use idempotency keys, reuse the open Checkout Session, limit subscriptions to one, and refund real duplicates.
If your Stripe webhook writes is_paid or plan into a Supabase profiles table, an "update own profile" policy often lets any signed-in user flip it from the browser. Test it in one minute and move the paid flag out of reach.
If your Stripe checkout unlocked fine in sandbox but real payments fail with "new row violates row-level security policy", permission denied, or an update that changes nothing, the webhook is writing to Supabase without a user session. Use the secret key on the server, and keep user tokens out of that client.
One missed Stripe webhook and a paying customer stays on the free plan. Here is why events get missed, how long Stripe retries, and a daily job that lists completed Checkout Sessions, compares them with your orders and fixes the gaps.
Checkout completed but the order stays pending forever, or the buyer got access before the money arrived? With ACH and other delayed payment methods, checkout.session.completed fires while payment_status is still unpaid. Handle async_payment_succeeded and async_payment_failed.
AI built your Stripe checkout and you are not sure the webhook is safe. Run these five checks before the first live payment: reject unsigned events, do not unlock from the success page, confirm the live endpoint and secret, and keep fulfillment idempotent.
Stripe does not guarantee webhook delivery order. invoice.paid can arrive before customer.subscription.created. Retrieve the invoice and subscription from the API instead of waiting for events in sequence.
A subscription renewal payment failed, yet the customer still has full access weeks later. Handle invoice.payment_failed, read past_due vs unpaid vs canceled, and make the end of retries actually change access.
Your marketplace never hears that a seller finished Stripe onboarding. Connected-account events only reach an endpoint listening to Connected accounts. Set up both scopes, both secrets, and test it.
Your AI builder put sk_live_ in client code, a VITE_ or NEXT_PUBLIC_ variable, or a public repo. Rotate it, move it server-side, switch to a restricted key, and roll the webhook secret if it leaked too.
The payment succeeded but metadata.user_id is empty in your webhook. Checkout Session metadata doesn't copy to the PaymentIntent or Subscription. Read it from checkout.session.completed or set payment_intent_data / subscription_data metadata.
Your Stripe webhook "verifies" signatures but still accepts forged events: the catch block logs the error and carries on, or verification is skipped when a header or secret is missing. How to spot it, fix it to fail closed, and test it with a bad signature.
Moved to a new domain and buyers pay, then land on the old site, or sign-in breaks? Fix Checkout success_url and cancel_url, Payment Link redirects, the Customer Portal return URL, payment method domains, and the Supabase Auth Site URL and Redirect URLs.
Your AI agent wrote green tests for the Stripe webhook, then production double-fulfills or returns 400 and 500. Sign test payloads for real, hit a real database, and run the Stripe CLI before you trust the suite.
AI builders sometimes put the Supabase service_role key in browser code so the "mark as paid" write works. That key bypasses RLS. Find it, move the write behind a verified Stripe webhook, and rotate the key.
The same failures on merchant-of-record platforms, sourced from each provider's docs.
Why Lemon Squeezy X-Signature checks fail (parsed bodies, escaped slashes, wrong secret or mode, non-200 replies) and the raw-body fix that works.
Fix Paddle-Signature mismatches: the ts:rawBody signed payload, per-destination secret keys, the five-second tolerance, and the 200-in-five-seconds rule.
Polar now signs with two schemes depending on when your secret was created. Fix webhook-signature failures, 403s from Bot Fight Mode, redirects and disabled endpoints.