UrgisoftAI-built apps

AI-built apps · November 2026

Stripe payments not working in your Lovable or Bolt app? Seven causes and the fix for each

Short answer: a payment has two halves. First your app sends the customer to Stripe's payment page. Then Stripe tells your app, server to server, that the money arrived (a webhook). AI builders usually get the first half working and leave the second half broken or unsafe, and that half does not show in the builder's preview. Find your symptom below; each one has a fix.

Where to look first (two minutes)

Three places tell you which half is broken:

  1. The browser's console (right-click the page, Inspect, Console) while you press the pay button: a red line here means the first half.
  2. Stripe, Workbench, Webhooks, your endpoint, the Event deliveries tab: every message Stripe tried to send, with the answer your app gave (200, 400, 401, 404). No endpoint listed, or failed deliveries, means the second half.
  3. Supabase, Edge Functions, the function's Logs: the real error behind a 400 or 500.

Match the symptom

What you seeCause
The pay button does nothing, or the payment page stays empty, inside the builder's preview1. Stripe's payment page does not open inside a frame
No such price, Invalid API Key provided, or it works with the test card and fails for real customers2. Test and live settings are mixed
Pressing pay gives blocked by CORS policy, Failed to send a request to the Edge Function, or a 5003. The function that starts the payment fails
Stripe shows the payment, the app still says "free"; Stripe's deliveries show nothing, 404 or 4014. Stripe's message never reaches your app
Deliveries show 400 and No signatures found matching the expected signature for payload5. The signature check fails
Deliveries show 200, and nothing changes in the database6. The function cannot find the user, or cannot write
People get the paid plan without paying, a failed payment still saves the order, or cancelled subscribers keep access7. The app trusts the browser instead of Stripe

The seven causes, and the fix for each

  1. Stripe's payment page does not open inside a frame. The builder shows your app inside a frame on its own page. Stripe's hosted payment page refuses to load in a frame, for the buyer's safety, so in the preview the button seems dead.
    Fix: test payments on the published address, in a normal browser tab. If the code opens Stripe inside the same frame, have it open the payment address in the full window (window.location.href = url) or a new tab. Use Stripe's test card 4242 4242 4242 4242 with any future date and any three digits while you are in test mode.
  2. Test and live settings are mixed. Stripe keeps two separate worlds: test (keys starting pk_test_ and sk_test_) and live (pk_live_, sk_live_). A product or price made in one does not exist in the other, so a live key with a test price id answers No such price. The webhook endpoint and its signing secret are also separate for each.
    Fix: when you go live, change four things together: the publishable key in the app, the secret key in the function's secrets, every price id (create the products again in live mode, or copy them over), and the webhook endpoint with its own new signing secret. Then make one small real payment yourself and refund it.
  3. The function that starts the payment fails. The browser asks a Supabase Edge Function to create the payment, because the secret key must stay on the server. Three things break it: the function does not answer the browser's permission question first (the OPTIONS request), which the console reports as blocked by CORS policy; the secret key was never saved in the function's secrets; or the function was written in the builder and never deployed to the Supabase project the live app uses.
    Fix: open the function's Logs in Supabase and read the error. The function must answer OPTIONS with the CORS headers and add the same headers to every other answer, errors included. Save STRIPE_SECRET_KEY under Edge Functions, Secrets, with exactly the name the code reads. Never put a key starting sk_ in the app itself: anything in a setting named VITE_… is downloaded by every visitor.
  4. Stripe's message never reaches your app. After a payment, Stripe calls an address you register. If none is registered in live mode, if it points at the preview or an old project, or if the function asks for a login, your app never hears about the payment. Supabase functions ask for a logged-in user by default, and Stripe is not one, so the delivery shows 401.
    Fix: in Stripe, Workbench, Webhooks, add https://<your-project>.supabase.co/functions/v1/<your-function> and choose the events the code handles (at least checkout.session.completed). Turn off the login requirement for this one function (verify_jwt = false in supabase/config.toml, or the "Verify JWT" switch in the function's settings): Stripe's signature is the proof of who is calling, see cause 5. Stripe keeps trying a failed live delivery for up to three days, and the Resend button works for 15 days, so payments missed while it was broken can still be delivered after the fix.
  5. The signature check fails. Stripe signs each message so nobody can fake a payment. The check fails for three reasons: the signing secret (whsec_…) belongs to a different endpoint or to test mode; the code reads the message as JSON before checking it, and the check needs the exact original text; or, in a Supabase function, the code uses the ordinary check, which stops with SubtleCryptoProvider cannot be used in a synchronous context.
    Fix: copy the signing secret from this exact endpoint's page in Stripe into the function's secrets. In the function, read the body with await req.text() and check it with await stripe.webhooks.constructEventAsync(body, signature, secret) before doing anything else. Never "fix" a 400 by removing the check: without it, anyone who knows the address can tell your app that they paid.
  6. The function cannot find the user, or cannot write. Stripe's message says a payment happened. It only says whose it was if your app told Stripe when it created the payment. And inside the function there is no logged-in user, so a database client made with the public key is stopped by row level security, often without an error.
    Fix: when creating the payment, pass the user's id as client_reference_id (or in metadata), taken from the caller's login on the server, not from a value the browser sends. In the webhook function, read it back and write with a client made from the service key (SUPABASE_SERVICE_ROLE_KEY), which exists only in the function's secrets. Check the result of every write and answer 500 when it fails, so Stripe tries again instead of the payment being lost.
  7. The app trusts the browser instead of Stripe. The quickest thing for a builder to write is "when the customer lands on the thank-you page, mark them as paid". Then anyone who types that page's address is paid, a buyer who closes the tab too early is not, and an order can be saved even when the card was declined. Subscriptions have the same hole at the other end: the app hears about the first payment and never about a cancellation or a failed renewal.
    Fix: only the webhook function sets "paid", and the thank-you page just reads it. Users must not be able to change their own plan column (the "who decides" test on our security page). For subscriptions, also handle customer.subscription.updated, customer.subscription.deleted and invoice.payment_failed. Stripe can deliver the same message twice and out of order, so save each event's id and skip one you have already handled.

Test it like a stranger before real customers arrive

On the published site, in test mode: (1) pay with 4242 4242 4242 4242 and close the tab the moment Stripe says the payment went through, before it sends you back: your account must still become paid within a minute. (2) Pay with the declined test card 4000 0000 0000 0002: nothing may be saved as paid. (3) Open the thank-you page's address directly in a new account: nothing may change. (4) Cancel a test subscription in Stripe: the app must take the plan away. If all four hold, both halves work.

This is a checklist from engineering practice, not a study: we have not counted how often each cause happens. The delivery rules (three days of retries, 15 days of Resend, duplicates, order) and the raw-body rule are from Stripe's webhook documentation; the function settings are from Supabase's own Stripe example. Error messages can differ a little between versions, and Stripe and Supabase rename their menus from time to time. It covers React apps with a Supabase backend and Stripe's hosted payment page, which is what Lovable and Bolt set up by default.

Other problems

Not sure the data is safe? Six security checks you can run yourself. Nobody can log in on the live site? Login and Supabase errors: seven causes and the fix for each. The app shows nothing at all? A blank page after publishing: six causes. Moving it to your own host? Deploy to Vercel or Netlify: the steps, and six errors that stop it. Slow on phones? Our demo shop, measured before and after: 14.5 s to 1.4 s. Built with Base44? Base44 bug fixing: seven common problems and the fix for each. Replit app bug fixing: seven common problems and the fix for each.

Want it fixed for you?

A payment that does not arrive in the app is a bug fix like any other. We fix apps made with Lovable, Bolt, Replit, Cursor and other AI builders, in your own code, and tell you in plain words what was wrong. Fixed prices on Fiverr: one bug from $40, up to five bugs with the app deployed and working live from $150. No fix, no charge. A GitHub invite is enough; we never ask for passwords or for your Stripe keys.

See the gig on Fiverr