An AI-built app can look finished while its payment flow only works in demo mode. The test card goes through, but nobody has checked what happens when a renewal fails, a webhook arrives twice or a customer in Germany pays. These are the eight things I check on a Stripe integration before real money moves. This is technical help, not tax or legal advice.
Short answer: switch keys, prices and webhook secrets to live mode together; let your server learn about payments from verified webhooks, not from the browser; make repeated requests and events harmless; decide what the app does when a renewal fails; add the Customer Portal; set up tax before the first EU sale; know the dispute process; and run a 15-minute test with test cards.
If your app takes payments for other people, like sellers or teachers on a marketplace, a normal Stripe account is not enough: read Stripe Connect basics as well.
1. Test keys, live keys and live products
Stripe keeps test mode (now called a sandbox) and live mode completely separate. On the API keys page, Stripe says each mode has its own keys and that objects in one mode aren't accessible to the other. A sandbox product can't be part of a live payment.
- Keys. Test keys start with
pk_test_andsk_test_, live keys withpk_live_andsk_live_. The secret key lives in your host's environment settings, never in code or the browser. - Products and prices. Hard-coded price IDs are test IDs. Recreate the products in live mode and swap the IDs.
- Webhook secret. It is separate from the API keys and differs per endpoint and mode. Copy the live one too.
The classic launch bug is a half switch: live publishable key, test secret key, and a checkout that errors for every real customer. Stripe also publishes a go-live checklist.
2. Webhooks: the app must learn about payment from Stripe
After paying, the browser is redirected to your "thank you" page. That proves nothing: the customer may close the tab, or someone may open the URL by hand. The reliable signal is the event Stripe sends to your webhook endpoint. Grant access only from that event.
- Verify the signature in the
Stripe-Signatureheader. Otherwise anyone who finds the URL can send a fake "paid" event. It needs the raw request body, so a framework that parses the body first breaks the check. - Answer fast. Return a 2xx before slow work; Stripe suggests a queue.
- Expect retries. In live mode Stripe retries a failed delivery for up to three days with exponential backoff.
- Expect duplicates and wrong order. Delivery order isn't guaranteed and an event can arrive twice. Store processed event IDs, and fetch the current object from the API when you need the latest state. How to do that step by step: duplicate records from double clicks and retries.
3. Double charges and idempotency
A customer double-clicks "Pay", or your server retries after a dropped connection. Each can create a second charge. Stripe's answer is the idempotency key: you send a unique Idempotency-Key header, and a retry with the same key returns the saved result instead of repeating the work. Keys can be removed once they are at least 24 hours old.
Hosted flows like Checkout handle much of this. It matters when your own code creates charges or subscriptions. Also disable the pay button after the first click, and make order handling safe to run twice.
4. Failed renewals and what the app does about them
Cards expire and banks decline. For subscriptions that is normal. Smart Retries picks retry times for you; for new accounts it is on by default with up to 8 retries in 2 weeks. Check the setting rather than assuming it.
What is left to your app is the status. After the last retry, the subscription becomes canceled, unpaid or stays past_due, depending on your settings, and the subscriptions guide says to revoke access when it is unpaid. Decide in advance which statuses keep access, what the customer is told when invoice.payment_failed arrives, and where they fix their card. AI-built apps often check only "has a subscription", so a customer whose card failed months ago keeps full access.
5. Cancel and update card: the Customer Portal
If customers can't cancel or change their card themselves, they email you or dispute the charge. The Customer Portal is a Stripe-hosted page where they can update payment methods, download invoices and cancel now or at period end. Turn it on in the dashboard and add a "Manage billing" button that creates a portal session when clicked; sessions are temporary, so don't store the link. For some subscriptions (multiple products, trials) customers can cancel but not change the plan.
6. EU VAT and sales tax
If you sell to EU customers you might need to collect VAT even when your business isn't based there, and rules and rates differ per country. Stripe Tax calculates tax from product, customer location and business location, and monitors thresholds. You still register where required and file returns.
- OSS. The One Stop Shop lets you register in one country and file a single return for consumer sales across the EU.
- Small EU sellers. Stripe describes an option for EU-based businesses with total EU sales under 10,000 EUR a year to individuals in other EU countries. Ask your accountant if it applies.
- Inclusive or exclusive. Set
tax_behavioron each price. Once set, it can't be changed, so decide before creating live prices.
7. Refunds and disputes
Refunds go to the original payment method, and Stripe's processing fees from the original payment aren't returned. Customers usually see them after 5 to 10 business days. Listen for refund.created to update the order.
In a dispute the customer's bank pulls the money back and Stripe debits the amount plus a dispute fee. The fee depends on your country, so check Stripe's pricing page. Per the docs, customers can typically dispute within 120 days, you usually have 7 to 21 days to respond depending on the network (miss it and you lose), and the bank's decision can take up to 3 months. You get one submission that can't be edited. Good evidence is what your app can produce on demand: the account, login and usage records, accepted terms and your messages with the customer.
8. Receipts and invoices
Stripe creates a receipt for each successful payment but doesn't email all of them. Turn on "Successful payments" under customer emails, and fill in the business details required on receipts. Automatic receipt emails only go out in live mode. Subscriptions get invoices automatically; for one-time Checkout payments you must enable invoice creation, which Stripe says is priced separately. Business customers will want a tax ID on the invoice, so check it.
The 15-minute pre-launch test
Run this in the sandbox, then repeat step 1 once in live mode with a small real payment you refund yourself. Card numbers are on Stripe's testing page.
- Pay with
4242 4242 4242 4242, any future expiry, any 3-digit CVC. Access must be granted by the webhook, not just the redirect. - Pay with the 3D Secure card
4000 0025 0000 3155, once completing and once abandoning the authentication. - Pay with the declined card
4000 0000 0000 0002. The customer sees a clear message and gets no access. - Run
stripe listen --forward-to localhost:4242/webhook(your own port and path) and watch the events arrive. - Run
stripe trigger payment_intent.succeeded, then resend the event. Nothing may happen twice. - Send a request with a wrong signature. The app must reject it.
- Open the Customer Portal, change the card, cancel. The app's status must follow.
Want this checked on your app?
I check and fix the payment side of apps built with Lovable, Bolt, Cursor or v0: keys, webhooks, failed renewals, the customer portal, tax settings and the test run above. See also the launch-ready checklist, or send me the details on the hire page and I'll reply within 24 hours.