Your lovable stripe flow charged test cards in the editor, then went silent the day real customers tried to pay.
Checkout looked polished. You dropped in Stripe, saw the test card succeed, and watched a thank-you page appear. You published. A customer paid. Stripe showed green. Your app still treated them like a free user. No webhook fired. No row landed in your database. Support tickets arrived before you found the toggle still on test mode.
Lovable + Stripe dead after launch
Payment failures after launch usually come from three gaps: wrong keys, missing webhooks, and success pages that lie.
Only the test card works on the live site
Real cards decline or the Checkout session never opens. The Dashboard still shows test mode enabled. Your deployed bundle still reads sk_test_... from an environment variable that never got a live counterpart on the host.
Customer paid but access never unlocked
Stripe records the payment. Your subscriptions table stays empty. The user refreshes the success URL and still sees the paywall. Without a webhook handler on production, backend logic never ran.
Webhook endpoint missing in live mode
Stripe CLI forwarded events to localhost during development. That tunnel closed when you shut the laptop. Live mode has no endpoint registered, or it still points at a preview URL that does not exist on the public internet.
Checkout redirects to the wrong domain
Success and cancel URLs still reference a Lovable preview hostname. Customers return to a host your app no longer serves. They think payment failed even when Stripe succeeded.
Stripe problems rarely stay isolated. They show up next to missing env vars and auth gaps on the same publish day. Start with the hub at lovable deploy, then wire the webhook path in stripe webhook.
Why the AI shipped lovable stripe in test mode
Lovable and similar tools optimize for safe demos. Stripe test keys let anyone run 4242 cards without touching real money. The AI wires test keys first because they always work in preview.
Checkout UI is easy to generate: a button, a redirect, a success component. Server routes that verify signatures and write database rows are harder to see in the editor. Agents often stop at the happy-path screen.
Webhooks need a public HTTPS URL. During build, that URL does not exist yet. Tutorials use stripe listen on localhost. The AI copies that pattern into comments and env examples. Nothing reminds you to register a live endpoint before launch.
Environment variables split across three places: Lovable preview secrets, a local .env file, and your deployment host. Code references STRIPE_SECRET_KEY. Only one environment has the value. Production builds succeed with empty secrets until the first charge fails.
Fix lovable stripe for production
Complete these steps on the live deployment, not only in the Lovable editor.
- Confirm live mode in Stripe. Open the Stripe Dashboard. Toggle off test mode. Copy the live secret key (
sk_live_...) and publishable key (pk_live_...). Do not paste the secret into frontend code. - Add live keys to your host. In Vercel, Railway, or your deployment settings, set
STRIPE_SECRET_KEYandNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY(or your framework’s public prefix) for the Production environment. Redeploy after saving. - Register a live webhook endpoint. In Stripe β Developers β Webhooks, add an endpoint URL on your production host, for example
https://yourdomain.com/api/webhooks/stripe. Subscribe tocheckout.session.completedfor Checkout andinvoice.paidif you sell subscriptions. - Copy the webhook signing secret. After creating the endpoint, open it and reveal the signing secret (
whsec_...). Add it asSTRIPE_WEBHOOK_SECRETin production env vars. Redeploy again. - Verify the handler verifies signatures. In Lovable, open your webhook route. It must read the raw body and call Stripe’s signature check. A handler that skips verification is unsafe and may ignore real events.
- Update Checkout success and cancel URLs. Search for
success_urlandcancel_url. Replace preview hostnames with your live origin. Use HTTPS only. - Run one real small charge. Use a live card you control. Confirm Stripe shows the payment, webhook delivery succeeds, and your database row appears. Refund the test charge if needed.
- Republish from Lovable if code changed. URL and key fixes in the host apply immediately only when code reads env vars correctly. Hardcoded test keys in source must be removed and redeployed.
Keep test and live webhook endpoints separate. A URL that worked with test keys does not automatically exist in live mode.
Checklist before you call lovable stripe live-ready
- Production env uses
sk_live_, notsk_test_ - Live webhook endpoint registered with correct events
STRIPE_WEBHOOK_SECRETset on the host and matches the live endpoint- Webhook handler verifies signatures and updates your database
- Checkout success and cancel URLs use your live domain
- One real payment test completed end to end
FAQ
Why does lovable stripe work in preview but not after launch?
Preview often uses Stripe test keys and localhost webhook forwarding. Production needs live API keys in your host environment, a public HTTPS webhook URL, and Checkout configured for your live domain.
Do I need a stripe webhook for lovable stripe payments?
Yes. The success page is cosmetic. Your server must receive checkout.session.completed or invoice.paid events to grant access, write orders, and send confirmation emails.
Where do I put Stripe live keys for a Lovable app?
Add STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET to your deployment host environment variables, not only inside Lovable preview settings. Redeploy after saving. Never put secret keys in client-side code.