HeHeedza

Why are Stripe payments not working in my Lovable app?

Last reviewed

Short answer

First find out which setup you have. Lovable has built-in payments (Lovable creates and manages the Stripe account) and your own Stripe account (you give it a key). On built-in payments, live checkout won't work until every go-live step is done. On your own Stripe, check the key's mode, the live price IDs and the checkout function's logs.

Why this happens

Lovable's two Stripe paths behave differently, and advice for one often doesn't apply to the other:

  • Built-in payments: Lovable creates the Stripe account, keys and webhooks, with separate test (preview) and live (published) environments. Live checkout stays off until you claim the Stripe account, finish Stripe onboarding and pass Lovable's readiness check. That check looks for a privacy policy, terms of service and a refund policy on your live site.
  • Your own Stripe account: you submit an sk_ or rk_ key in Lovable's Connect Stripe form. It's stored as the STRIPE_SECRET_KEY backend secret. The key decides the mode, and by default there are no webhooks: the app asks Stripe for subscription status and matches users by email.

Your homepage won't tell you

A Lovable marketing page is static enough to keep returning 200 after a publish breaks the route that actually takes money. An uptime monitor hits that page, stays green, and the first person to notice is a customer.

Checkout fails in a few repeatable ways, and they look the same from outside (the customer can't pay):

  • the /checkout or pricing route 404s after a regenerate
  • a client component throws before the form renders, so the page goes blank (the browser console usually names a missing env var)
  • the Payment Link or price ID was rotated or doesn't exist in live mode
  • the pay button works but the function that creates the Checkout Session is missing its secret, so it errors on click

Open the checkout URL in a private window. If you see the Lovable 404 shell, the route was dropped. If you see the card form, stop: don't pay. A visible form means the page is up, and a failed charge after that is a key, price or webhook problem covered below.

How to fix it, step by step

Step 0: identify your setup. Open More → Payments. A Self-managed Stripe badge means your own account. Otherwise you're on built-in payments.

If you're on built-in payments:

  1. Work through the go-live checklist in the Payments tab: claim the Stripe account, complete onboarding in Stripe, and pass the readiness check. Lovable's docs say live checkout won't work until every step is done.
  2. Add the legal pages the readiness check needs (privacy, terms, refunds), then publish again.
  3. Don't delete Lovable's webhook endpoints in Stripe. There are two per environment: one for your app, one for Lovable's monitoring. Lovable's docs warn that deleting your app's endpoint means purchases still succeed but features never unlock.
  4. "Invalid webhook signature"? Check that the handler still exists and that no duplicate endpoint points at the same URL. Then ask Lovable to rotate that environment's webhook secret, and publish again straight away.
  5. Manage products through Lovable, not the Stripe Dashboard. Lovable syncs test to live when you publish, and edits made directly in Stripe can cause ID mismatches.

If you're on your own Stripe account:

  1. Check the key's mode. An sk_test_ or rk_test_ key means test only. To go live, submit a live key in the Update Stripe secret key form, then ask Lovable to switch to your live price IDs, which differ from the test ones.
  2. Read the error. Look at the function logs (the Cloud view's logs, or Supabase → Edge Functions → Logs on your own Supabase) and at Stripe → Developers → Logs for the failed request.
  3. Checkout doesn't open? It opens in a new tab, so a popup blocker can stop it. Allow popups and try again.
  4. Paid but no access? Subscriptions are matched by email, so the email the customer signs in with must match their Stripe customer email. If you need instant updates, ask Lovable to add a webhook, create the endpoint in Stripe and store its signing secret.
  5. Customer portal error? Activate the portal once in the Stripe Dashboard, and test it in a normal browser tab. It doesn't work inside the Lovable preview panel.

Either way: never paste a Stripe secret key into the chat as a message. Use the form.

Fix prompt for your AI builder

Paste this into Lovable, Bolt, Cursor, Claude, ChatGPT, Replit, v0 or whichever tool you build with. Replace the bracketed parts first.

Keep the prompt narrow. Vague prompts ("fix checkout") tend to regenerate half the app. Name the path, say the homepage is fine, and forbid a test payment.

Fix prompt
Stripe payments in this Lovable app aren't working. What happens: [describe: checkout doesn't open / error message / paid but no access]. The function log says: [paste].
Please, without redesigning anything:
1. Tell me whether this project uses built-in payments or my own Stripe account, and which mode (test or live) the published app uses.
2. Fix the checkout function error shown in the logs. Make sure price IDs match the current mode.
3. Make sure paid features unlock for the signed-in user after a successful payment, and explain how the subscription is matched to the user.
Don't create real charges while testing, and don't ask me to paste keys into the chat.

How to catch this next time

Lovable payment setups break on publish: a sync that didn't run, a key rotated in Stripe, a webhook endpoint deleted while "cleaning up".

Heedza checks your published app's checkout page on a schedule. It confirms the payment form or pay button shows, stops before paying, and emails you a screenshot and a Lovable-ready fix prompt when it doesn't. Its passive scan also flags a Stripe secret key showing up in your public JavaScript. Run the free scan on your published URL.

Questions

Does Lovable checkout work in the preview?

Yes. Built-in payments run in test mode in the preview. With your own Stripe account, the preview uses whatever key you submitted, so a live key means real charges.

Why does live checkout fail on built-in payments?

Live checkout stays off until the go-live checklist is complete: claiming the Stripe account, Stripe onboarding, and the readiness check for legal pages.

Can I use built-in payments and my own Stripe account together?

No. A project uses one or the other. You disconnect one before enabling the other.

Where is my Stripe key stored?

With your own Stripe account, it's a backend secret called STRIPE_SECRET_KEY. It lives in Cloud Secrets, or in your Supabase Edge Function secrets if you use your own Supabase, and never in your app's code.

Sources

Lovable Stripe payments not working? Fix checklist · Heedza