Skip to content
FirstUser

For builders shipping this week

Lovable Stripe checkout not working? 6 checks, then a real first-buyer test

FirstUser goes through your live Lovable app like a brand-new buyer: sign up, click Upgrade, reach Stripe Checkout, and tells you exactly where it stops. Screenshot of the failed step, plain-English diagnosis, and a fix prompt you can paste back into Lovable. Run a free test → — no account, no card.

Why checkout "works" for you and not for buyers

When you test checkout yourself, you are logged in, you are often inside Lovable's preview, and your Stripe account may still be in test mode. A first buyer is on the published URL, has a brand-new account, and expects a live payment page. Most "Stripe checkout not working in my Lovable app" reports come down to one of the six checks below. Go in order; the first ones are the most common.

1. The button does nothing: look at the browser console and the Network tab

Open your published app (not the preview), open DevTools, click the Upgrade/Buy button and watch two places:

  • Console: a red error such as Edge Function returned a non-2xx status code or FunctionsHttpError means the request reached your Supabase backend and the function failed. Go to check 2.
  • Network: find the request to /functions/v1/.... Status 401 means the function did not get a logged-in user (check 5). Status 500 means the function crashed (check 2 and 3). No request at all means the click handler never ran or a popup was blocked (check 4).

Projects on Lovable's built-in backend (Lovable Cloud) find the function logs under More → Settings → Logs. Projects on their own Supabase use the Supabase dashboard Edge Functions logs. Stripe Dashboard → Developers → Logs shows Stripe's own error message.

Paste the exact error text into Lovable instead of "checkout is broken". "The create-checkout function returns 500 with message X" gets a much better fix.

2. "Edge Function returned a non-2xx status code": the Stripe secret key is missing or wrong

Checkout sessions must be created on the server with your Stripe secret key. In a Lovable + Supabase app that usually happens in a Supabase Edge Function, which reads the key from Supabase secrets (for example STRIPE_SECRET_KEY).

Fix:

  • In Supabase, open Edge Functions → Secrets (or Project Settings → Edge Functions) and check that the secret exists with exactly the name the function reads.
  • Open the function logs. Projects on Lovable's built-in backend (Lovable Cloud) find the function logs under More → Settings → Logs. Projects on their own Supabase use the Supabase dashboard Edge Functions logs. Stripe Dashboard → Developers → Logs shows Stripe's own error message. Invalid API Key provided or an empty key shows up there, not in the browser.
  • The secret key (sk_test_... / sk_live_... or a restricted rk_... key) must never be in frontend code or a VITE_ variable. If Lovable ever put it there, roll the key in Stripe and move it to Supabase secrets.

3. "No such price": test-mode IDs with a live key (or the other way round)

Stripe test mode and live mode are separate worlds. A price ID created in test mode does not exist in live mode. The typical error in the function logs:

No such price: 'price_...'; a similar object exists in test mode, but a live mode key was used to make this request.

Fix: when you switch to sk_live_..., recreate the product and price in live mode and update the price ID in your code or database. Same for coupons, customers and webhook endpoints. Going the other way (live price, test key) gives the mirror error.

4. Stripe Checkout won't open in the preview ("refused to connect") or the new tab is blocked

Stripe Checkout cannot be shown inside an iframe. Lovable's editor preview is embedded in the editor page, so redirecting the preview to checkout.stripe.com can show "refused to connect" or simply nothing. That is a preview limitation, not proof your checkout is broken: test on the published URL.

Lovable's default one-time checkout opens Stripe Checkout in a new tab. If your checkout opens in a new tab after waiting for the function, some browsers (especially Safari and mobile) can block it as a popup; if that happens, ask Lovable to redirect in the same tab instead.

5. 401 or "User not authenticated": the function doesn't see the logged-in buyer

If your checkout requires a logged-in user, many checkout functions look up the current user to attach the email or customer ID. Lovable's one-time checkout also works for logged-out buyers, where Stripe collects the email. If the frontend calls the function without the user's session (or before the session has loaded right after signup), the function rejects the call.

Fix: call the function through the Supabase client after the session exists (the client sends the user's access token), and don't show the Upgrade button until the auth state has loaded. Test with a brand-new account, because "it works for me" usually means "it works for an account that has been logged in for days".

6. Payment succeeds but the app still shows the free plan

Checkout opened, the card went through, and the buyer is still on Free. That's no longer a checkout problem but the unlock step: a webhook that never arrives, a webhook signing secret from the wrong mode, or a subscription check that looks up the wrong email. The English checklist is Paid in Stripe, but the plan is still free. The shorter German note is Bezahlt, aber kein Pro.

The test that catches all six: buy like a stranger

  1. Open the published URL in a private window.
  2. Sign up with an address you've never used, confirm the email, log in.
  3. Click Upgrade. You should land on checkout.stripe.com in the same mode you think you're in (test mode shows a "Test mode" badge).
  4. In test mode, pay with Stripe's test card 4242 4242 4242 4242 (any future date, any CVC). Check you come back to your success page and the plan actually changes.
  5. Repeat on a phone.

FirstUser runs this flow for you on your live URL, as a new visitor, and sends a screenshot of the step that failed plus a fix prompt for Lovable. Point automated checkout tests at Stripe test mode.

Run a free test on your Lovable app →

Checklist

Get this checklist by email

We will email this checklist to that address. Privacy policy