Stripe payments in a Lovable or Bolt app, why they break and how to fix them

Faizan Ali Arshad
Updated , 8 min read
Short answer
Most Stripe problems in Lovable or Bolt apps come from a few places. Test and live keys get mixed up, a webhook never reaches the app or fails its signature check, or the app unlocks features because the browser says so instead of Stripe. Check those first, then test the whole flow with a real purchase before customers use it.
Payments are where an AI-built app stops being a prototype. A broken button on a settings page is annoying. A broken payment means lost money, or customers who paid and can’t get in.
Lovable and Bolt can set up Stripe for you, and often it works first time. When it doesn’t, the cause is usually one of a handful of things. This guide explains them in plain terms, so you can find yours or explain it to a developer.
How payments work in these apps
There are two halves to every payment:
- The customer pays. Your app sends them to a Stripe checkout page, and Stripe takes the money.
- Your app finds out. Your app has to learn that the payment happened, then unlock what was paid for.
Most problems are in the second half. Your app can find out in two ways:
- It asks Stripe. Lovable’s own Stripe integration works this way by default. According to its documentation, the app checks payment and subscription status with Stripe directly, and webhooks aren’t used unless you ask for them.
- Stripe tells it. Stripe sends a message, called a webhook, to a small backend function in your app, usually a Supabase edge function. This is needed when something should happen the moment a payment succeeds, like fulfilling an order.
The usual causes
1. Test and live are mixed up
Stripe has a test mode and a live mode, and they’re completely separate. Keys, products, prices, webhook endpoints and webhook signing secrets all differ between the two. Stripe’s documentation notes that even when the same endpoint is used for both, the signing secret is different for each.
When an app goes live, every one of those values has to switch. Missing one, like a test price ID or a test signing secret, is the most common reason payments work in testing and fail for real.
One Lovable detail to know: its documentation says the preview has no separate test environment. With a live key in place, payments made from the preview are real.
2. The webhook never reaches your code
If the app uses webhooks through a Supabase edge function, there’s a common trap. Edge functions check for a Supabase login token by default. Stripe doesn’t send one, so the request is rejected with a 401 error before your code even runs.
The fix is to turn off that check for the webhook function only, and verify Stripe’s signature inside the function instead. Supabase’s documentation shows how. Don’t turn it off for any other function.
3. The signature check fails
Stripe signs every webhook, and your function should check that signature before trusting the message. Without the check, anyone could send your app a fake “payment succeeded” message.
The check fails when the signing secret is wrong, often a test secret in live mode, or when the message has been changed before checking. Stripe’s documentation says verification needs the raw, unchanged request body.
4. The app trusts the browser
Some AI-built apps unlock paid features as soon as the customer lands on the “payment successful” page. That page is just an address. Anyone can visit it without paying.
Paid features should only unlock after Stripe confirms the payment, through a verified webhook or by your backend checking with Stripe. This is also on my list of 10 vibe coding mistakes that break apps in production.
5. Subscriptions break after the first payment
The first payment is the easy part. Subscriptions also renew, fail when a card expires, get upgraded, downgraded and cancelled. Each of those needs handling, or customers keep access they stopped paying for, or lose access they still pay for.
Two details worth checking:
- How users are matched to payments. Lovable’s documentation says subscriptions are matched to users by email address. If a customer pays with a different email from the one they log in with, they won’t get access.
- The customer portal. To let people manage or cancel their own subscription, the Stripe customer portal has to be activated once in your Stripe dashboard.
6. Repeated or out-of-order events
Stripe may send the same webhook more than once, and it doesn’t guarantee the order. Its documentation recommends recording the IDs of events you’ve already handled and skipping repeats. In live mode, Stripe also retries failed deliveries for up to three days, so a bug can keep firing long after you fix it.
How to find out what’s wrong
Stripe shows you most of what you need:
- In the Stripe dashboard, open Webhooks and select your endpoint.
- Open Event deliveries. Each event shows whether it was delivered or failed, with the response your app gave.
- Read the status code:
- 401 or 403: your app refused the request. In a Supabase setup, that’s usually the login token check from cause 2.
- 404: the webhook address is wrong, or the function doesn’t exist.
- 400: often a failed signature check, from cause 3.
- 500: your function crashed. Its logs will say why.
- Timed out: your function took too long. Stripe says to reply quickly and do slow work afterwards.
If there are no events at all, check that the webhook is set up in the right mode (live or test) and subscribed to the events your app needs.
Before you take real money
Run through this once, in order:
- Make a full purchase in test mode and check that access is granted.
- Check Event deliveries shows every event as delivered.
- Cancel the test subscription, or refund the test payment, and check that access is removed.
- Switch everything to live: secret key, price IDs, webhook endpoint and signing secret.
- Make one real purchase with your own card, check access, then refund it.
If any step fails and you can’t see why, a developer can usually find it quickly from the Stripe event log and the function logs. That’s a common job in my vibe code rescue service. If you’re handing the app over, here’s what to prepare.
Common questions
Why does my Stripe webhook fail with a 401 error in Supabase?
Supabase edge functions check for a Supabase login token by default, and Stripe doesn't send one. The request is rejected before your code runs. Turn off that check for the webhook function only, and verify Stripe's signature inside the function instead, as Supabase's documentation describes.
Do I need webhooks with Lovable's Stripe integration?
Not always. Lovable's documentation says its Stripe integration doesn't use webhooks by default, and the app checks payment and subscription status with Stripe directly. You need a webhook when something has to happen the moment a payment succeeds, like fulfilling an order or sending a receipt from your own system.
Why do test payments work but live payments don't?
Test mode and live mode are separate in Stripe. Keys, prices, webhook endpoints and webhook signing secrets all differ between them. When you go live, every one of those has to be switched, and one missed value is enough to break the flow.
Is it safe to unlock paid features on the payment success page?
No. Anyone can visit a success page without paying. Only unlock features after Stripe confirms the payment, either through a verified webhook or by your backend checking with Stripe directly.
Got a question this guide doesn’t answer? Email me.
hi@faizanali.dev