Lovable Stripe payments work in the preview but fail on the published app
Updated First published
On this page (4)
Symptom
Checkout works in the Lovable preview with a test card, but on your published app or custom domain it doesn't open, shows an error, or takes the payment without unlocking the paid features.
Cause
This page is only about payments: checkout, subscriptions and paid features. If the whole published app is blank, broken or empty, start with Lovable preview works, published app doesn’t. Subscriptions also need people to sign in, so if signing in itself fails on the published app, see Lovable login works in preview but not on the published site.
The facts below come from Lovable’s docs on built-in payments and connecting your own Stripe account, and from Stripe’s docs on API keys and testing, checked October 20, 2026. Menu paths in Lovable were updated on October 28, 2026, from Lovable’s editor docs (section “The More menu”) and changelog, after the redesigned More menu.
First, find out which payment setup you have
Lovable can add Stripe payments to your app in two different ways. A project uses one or the other, never both at the same time, and the fix is different for each.
| Built-in payments | Your own Stripe account | |
|---|---|---|
| Who created the Stripe account | Lovable, for you | You |
| How it was connected | You asked Lovable for payments and filled in a short setup form | You submitted a Stripe key in a Connect Stripe form |
| Plan | Pro plan or higher | Works on the Free plan |
| Test and live | Preview is test mode, published app is live mode | One key at a time: the key decides the mode, in the preview too |
| What Payments shows (More menu) | A toggle between test and live data, and a go-live checklist | A Self-managed Stripe badge |
If you’re not sure, the prompt on this page asks Lovable which one your project uses, without changing anything. If you’re still choosing how checkout should look, a Stripe-hosted page or a checkout inside your site, see Stripe Checkout: hosted page vs embedded.
If you use built-in payments
Lovable runs two separate payment environments. Test mode is what you use in the preview: checkout only accepts test cards and no money is charged. Live mode is your published app: real cards, real money. Lovable’s docs say payments in the preview work right away after setup, but checkout on your published app will not process real payments until you complete the go-live steps. So “works in the preview, fails when published” is exactly what you see before going live.
To go live with Stripe, open Payments from the More menu and follow the go-live checklist:
- Claim your Stripe account. Click the link in the Payments tab to claim the Stripe account Lovable created for you. Stripe calls it your “sandbox” account. If you already have a Stripe account, you can link the sandbox to it in this step.
- Finish the go-live steps in Stripe. In the Stripe dashboard: set up your Stripe account, verify your email and complete account onboarding. Stripe then asks you to copy your products, prices and the Lovable app from your test account to your live account. That step connects your live keys and webhooks.
- Pass the readiness check. Lovable reviews your live site for a privacy policy, terms of service, a refund policy, and genuine, substantive content. If something is missing, ask Lovable to add it and run the check again.
Lovable’s docs say most account reviews finish within a day, but some take several days. They also suggest connecting a custom domain before going live, because the payment provider reviews your live domain.
Things that break live checkout after you go live:
- Discount codes. When you publish, products and prices sync from test to live, but discount codes don’t. Create them in live on purpose, for example by asking Lovable: “In live, create a 20% discount code LAUNCH valid for the first 3 months.”
- Editing products in the Stripe dashboard. Lovable’s docs say this can cause ID mismatches between test and live. Manage products through Lovable.
- Deleting webhook endpoints. Lovable registers two endpoints per environment, and they can look like duplicates in Stripe. Don’t delete or disable either one. If your app’s endpoint is gone, purchases still succeed, but subscriptions never activate and features never unlock. Your app’s endpoint ends in
?env=sandboxfor test and?env=livefor live.
If you use your own Stripe account
Here there’s no separate test environment. Your project uses one Stripe key at a time, and that key decides everything:
- A test key starts with
sk_test_orrk_test_. Everything stays in Stripe’s test mode, and the test card4242 4242 4242 4242works. - A live key starts with
sk_live_orrk_live_. Payments are real, including payments you make from the preview. - Keys that start with
pk_(publishable keys) don’t work in the form.
Stripe’s docs explain why test setups don’t carry over: each mode has its own set of keys, and objects in one mode aren’t accessible to the other. A product you made in test mode can’t be part of a live payment. That’s why going live takes three steps, from Lovable’s docs:
- Switch to a live key. Ask Lovable to update your Stripe key, and submit a live key in the Update Stripe secret key form.
- Switch to live products and prices. Check in Stripe that your products and prices exist in live mode. Price IDs are different in test and live mode, so ask Lovable to switch your app to the live price IDs.
- Confirm with a real purchase on your published app.
If checkout fails with an error, the error comes from the checkout function Lovable wrote. Read what Stripe returned in two places:
- The function logs: on Lovable Cloud, open More → Settings → Logs. On your own Supabase project, open the logs under Edge Functions in the Supabase dashboard.
- Stripe’s own record: in the Stripe dashboard, go to Developers → Logs to see the failed request and Stripe’s error message.
Then paste the error into the project chat and ask Lovable to fix it.
If checkout doesn’t open at all, a popup blocker may be stopping it, because checkout usually opens in a new tab. Allow popups for your app’s address and try again. And check the card: Lovable’s docs say to use Stripe’s test card only with a test key, and a real card only with a live key.
The customer portal (Manage subscription)
The page where subscribers cancel or change their plan is hosted by Stripe. It opens in a new browser tab and doesn’t work inside the Lovable preview panel, with either setup. Test it on your published app or in a standalone browser tab. With your own Stripe account, you also need to activate the portal once in your Stripe dashboard, following Stripe’s customer portal guide.
Two safety rules
- Never paste a Stripe key into the chat. Lovable’s docs say to enter it only in the Connect Stripe or Update Stripe secret key form. It’s stored as a backend secret, not in your app’s code.
- Don’t test with real cards. Stripe’s testing docs say not to use real card details, and that the Stripe Services Agreement prohibits testing in live mode with real payment details. Do your testing in test mode with test cards. The one real purchase Lovable suggests is the final check that you’re live, not a way to debug.
If you’re wondering what payments cost: with your own account, Stripe bills you at Stripe’s standard rates, and Lovable’s docs say using Stripe through built-in payments costs the same as setting it up directly.
Prompt to paste
Copy the text below, replace what’s in brackets and send it in the chat of the tool you’re using.
Payments work in the preview but not on my published app.
What happens on the published app: [for example "checkout doesn't open", "I see an error" or "the payment goes through but the paid features don't unlock"]
Don't change any code yet. First tell me in plain English:
1. Which payment setup this project uses: Lovable's built-in payments, or my own Stripe account connected with an API key.
2. Whether the published app is using live mode and the live price IDs.
3. The latest checkout or webhook error in the logs, and what it means.
Then tell me what you would change to fix it, and wait for my confirmation before changing anything.How not to burn credits
- Most causes are go-live steps, keys or price IDs, not code. Asking Lovable to rebuild the checkout costs credits and doesn't touch any of them.
- On built-in payments, check the go-live checklist in the Payments tab first. It's free and shows what's still missing.
- Send one diagnostic prompt, like the one on this page, and read the answer before asking for a fix.
- Do your testing in test mode with Stripe's test cards, as many times as you need. Leave the one real purchase on the published app for the very end, to confirm you're live.
How Lovable counts credits, and what the free plan includes: Lovable credits explained.
Questions people ask
Why does Stripe checkout work in the Lovable preview but not on my published app?
With Lovable's built-in payments, the preview uses test mode and the published app uses live mode. Lovable's docs say checkout on the published app won't process real payments until you complete the go-live steps in the Payments tab, including claiming the Stripe account, Stripe's onboarding and a readiness check. With your own Stripe account, check that you submitted a live key and that the app uses the live price IDs, because test and live prices have different IDs.
How do I know if my app uses built-in payments or my own Stripe account?
Open Payments from the project's More menu. If it shows a Self-managed Stripe badge, the app uses your own Stripe account, connected with a key. If it has a toggle between test and live data and a go-live checklist, it uses built-in payments. Built-in payments need the Pro plan or higher, so on the Free plan it's your own Stripe account. You can also ask Lovable with the prompt on this page.
The payment went through but the paid features didn't unlock. Why?
With built-in payments, Lovable's docs say the usual reason is a deleted webhook endpoint. Lovable registers two endpoints per environment in Stripe, and deleting your app's endpoint means purchases still succeed but subscriptions never activate. Don't delete either one. With your own Stripe account, subscriptions are matched by email address, so the email the person signs in with must match the email on their Stripe customer record.
What does "Invalid webhook signature" mean?
Your app checks every payment event from Stripe with a secret, and the check failed. Lovable's docs say to first check that the webhook handler still exists in your app and that no duplicate endpoint points at the same address. If every delivery in one environment still fails, ask Lovable to rotate the webhook secret for that environment and publish again right after. Events that failed before or during the rotation aren't sent again, so check those payments in Stripe.
The Payments tab says "The live API key is invalid". What do I do?
Lovable's docs say this means the connection Lovable holds for your payment provider stopped working, usually because the key was deleted or rotated in the provider's dashboard. Your Stripe account and its data aren't affected. Contact Lovable support to get the connection restored.
New guides by email. An email when we publish a new guide, error fix or chapter, in plain English. Subscribe