Payments go through but nothing unlocks? Check your Stripe webhook
Your checkout works. The customer pays, Stripe shows the money, and the success page says thanks. But the account never upgrades, the order never lands in your database, and the welcome email never goes out. The problem sits in a part of the app nobody looks at: the webhook.
This is one of the most common ways an app built with Lovable, Bolt, Replit, v0 or Cursor quietly breaks after it goes live. It usually worked fine in test mode, which is exactly why nobody notices.
The symptom
- Payments appear in the Stripe Dashboard, but your app still treats the customer as unpaid.
- Subscriptions start, but the plan, credits or access never change in your database.
- It worked during testing and stopped the day you switched to live keys or moved to a custom domain.
The cause
Most AI-built apps don't trust the browser to say "this person paid." Instead, Stripe calls a URL on your server (the webhook endpoint) with an event such as checkout.session.completed, and that server code updates your database. If that call fails, the payment still succeeds, because Stripe and your app are separate systems. Only the follow-up step breaks.
The usual reasons it fails in production:
- The endpoint only exists in test mode. Stripe keeps test and live webhook endpoints separate. Creating one in test mode does nothing for live payments.
- The signing secret is wrong. Each endpoint has its own secret starting with
whsec_. A test secret in your live environment makes every signature check fail. - The URL points somewhere that isn't production. A preview URL, a dev URL that sleeps, or an old domain you've since moved away from.
- Something in front of the function rejects Stripe. An auth check, password protection on a preview, or a firewall rule returns 401 or 403 before your code runs.
- The body gets parsed before verification. Stripe signs the raw request body. If your framework turns it into JSON first, the signature check fails with an error like "No signatures found matching the expected signature."
Step-by-step diagnosis
- Open the Stripe Dashboard, make sure the live/test toggle is on live, and go to the Webhooks section (under Developers or Workbench, depending on your Dashboard version).
- Check that a live endpoint exists and that its URL is your real production domain, not a preview or dev address.
- Open the endpoint and look at recent event deliveries. Stripe shows the HTTP status your server returned for each attempt.
- Read the status. A 404 means the URL is wrong. A 401 or 403 means something is blocking Stripe before your code runs. A 400 usually means signature verification failed. A 500 means your code crashed, so check your function logs. Timeouts mean the handler is too slow.
- Compare the endpoint's signing secret with the one set in your production environment variables. They must match exactly, and they must come from the live endpoint.
- Confirm the endpoint is subscribed to the events your code actually handles, such as
checkout.session.completedorcustomer.subscription.updated.
Fixes by builder and host
Lovable and Bolt with Supabase Edge Functions
Supabase Edge Functions check for a Supabase JWT by default, and Stripe doesn't send one, so every webhook gets a 401. Turn JWT verification off for the webhook function only (deploy it with --no-verify-jwt or set verify_jwt = false for that function in config.toml), and rely on Stripe's signature check instead. Then add the live STRIPE_WEBHOOK_SECRET to the function's secrets.
v0 and Next.js on Vercel
In a route handler, read the body with await request.text() and pass that raw string to stripe.webhooks.constructEvent. Don't call request.json() first. Point Stripe at your production domain, because preview deployments can sit behind Vercel's deployment protection and return 401.
Replit
Use your deployment's URL or custom domain, not the workspace dev URL, which changes and stops responding when the workspace isn't running. Put the live secret in the deployment's secrets, not just the workspace.
Cursor and custom stacks
The same rules apply on any host: a live endpoint on the production URL, the matching live secret, the raw body for verification, and no auth middleware in front of the webhook route.
How to verify
- After fixing, open a failed event in the Dashboard and resend it. You should see a 2xx response and the change in your database.
- Make one small real purchase on the live site, confirm access unlocks, then refund it.
- Check your function logs for that event to be sure your code ran, not just that it returned 200.
Prevention
- Treat "switch to live" as a checklist: live keys, a live webhook endpoint, a live signing secret, and a real test purchase.
- Update the webhook URL whenever you change domains.
- Have the handler log every event it receives, and return an error when verification fails, so problems show up in Stripe instead of disappearing.
Webhooks are invisible from the outside, but many problems that do show, like broken pages and missing env vars, can be caught before a customer finds them.
