Payments
Add payments the safe way
Checkout looks done when the success page shows, and that page proves nothing.
- What you get
- Prices set on the server, and access granted only when the payment provider confirms it.
- Paste it into
- Your AI tool, in your project
The prompt
Add payments to this project using [Stripe or another provider], and build it so it can't be tricked. Rules: prices and products are defined on the server or in the provider's dashboard, never taken from the browser. Access is granted only when the provider's webhook says the payment succeeded, not when the user reaches the success page. Keys stay in environment variables, with test keys everywhere except production. Before coding, tell me the flow in five steps and what gets stored in my database. After coding, test it in test mode: a successful card, a declined card, and closing the tab mid-payment. Show me what the database holds after each.
Use it
Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in. Replace the parts in [brackets] with your own details first.
More in Payments
Make payment webhooks reliable
A customer pays, the webhook fails or arrives twice, and their account is wrong.
Someone paid and didn’t get access
The money arrived and the account still says free. Or the reverse.
Switch payments from test to live
Everything works with test cards, and live mode has its own keys, webhooks and settings.
Handle every subscription state
Signing up to a plan works, and nothing happens when a card fails or someone cancels.