Stripe form missing live? Check your keys
You test the checkout on your preview and the card form appears, takes a test card and says thanks. Then you open the live site, click Buy, and nothing happens. Sometimes the space where the payment form should be is just empty. Visitors who wanted to pay simply leave.
This is common on sites built with Lovable, Bolt, Replit, v0 or Cursor, because the payment setup usually gets wired up and tested in one environment, then copied to production with one piece missing or mismatched.
The symptom
- The Stripe Payment Element (the embedded card form) never renders on the live domain, or renders and then shows an error.
- A "Checkout" or "Subscribe" button does nothing, or fails before the Stripe Checkout page opens.
- Apple Pay or Google Pay buttons appear in preview but not live.
The cause
Stripe payments need two halves that agree with each other. The browser loads Stripe.js with a publishable key (it starts with pk_test_ or pk_live_). Your server uses a secret key (sk_test_ or sk_live_) to create a PaymentIntent or a Checkout Session. If those keys come from different modes or different Stripe accounts, or one of them is missing on the live build, the form has nothing valid to show.
The usual culprits:
- Test vs live mismatch. The front end still has
pk_test_while the server usessk_live_, or the other way round. The server creates an object the browser key cannot see, so the form fails. - Missing production variable. The publishable key was set in preview but never added to the production environment. On Vite builds it must be prefixed
VITE_, on Next.jsNEXT_PUBLIC_, and it is baked in at build time, so adding it later means a fresh deploy. - Wrong Stripe account. Keys copied from a teammate's or an old Stripe account. Both halves look valid, but they do not belong together.
- Content Security Policy. A strict CSP header that does not allow
https://js.stripe.comin script and frame sources stops Stripe.js or its iframe from loading. - Browser extensions. Some privacy or ad blocking extensions interfere with third-party scripts, which explains the "works for me, blank for some" pattern.
- Payment methods per mode and domain. Methods are switched on separately for test and live, and wallet buttons such as Apple Pay need your live domain registered in Stripe.
Step-by-step diagnosis
- Open the live site in a private window with extensions off and open the browser console. Look for red errors mentioning Stripe, an invalid key, "No such payment_intent", or a blocked script.
- Search the page source or network requests for
pk_. Note whether it saystestorlive. - In the network tab, click Buy and find the call to your own server that creates the payment. Check its response: a 500, an auth error, or a message about a missing key tells you the server half is broken.
- In the Stripe Dashboard, check the Developers logs in the matching mode. If there is no request at all, the server never reached Stripe. If there is an error, it usually names the problem.
- Check the response headers of your page for
Content-Security-Policyand confirm it allowsjs.stripe.com. - Try again with extensions back on. If it only breaks then, it is the visitor's browser, not your setup.
Fixes by builder or host
Lovable and Supabase
Keep the secret key in Supabase Edge Function secrets, never in front-end code. Put the matching publishable key wherever your project reads it, then redeploy the edge function and republish so both halves use the same mode.
Bolt or v0 on Netlify or Vercel
Add the publishable key with the right prefix to the production environment, not just preview, and the secret key without a public prefix. Trigger a new production deploy after changing either.
Replit
Workspace secrets and deployment secrets can differ. Add both keys to the deployment's secrets, then redeploy.
Cursor or custom code
Grep the repo for hard-coded pk_test_ strings, move keys to environment variables, and add https://js.stripe.com to script-src and frame-src if you send a CSP header.
If payments go through but the account never upgrades afterwards, that is a different problem: see our post on live Stripe webhooks.
How to verify
- Load the live checkout in a private window: the form renders with no console errors.
- The live page uses
pk_live_and the server request shows up in the Dashboard's live logs. - Make one small real purchase and refund it in the Dashboard, so you know the whole path works with live keys.
Prevention
- Name variables clearly per mode and keep a short checklist of every payment variable that production needs.
- Never paste keys into code; keep them in each host's secrets.
- When you switch from test to live, change both keys in the same deploy.
- Check the checkout page from outside after every release, because a missing form loses money quietly.
Make sure visitors can actually pay you.
