Stripe Checkout + webhook to unlock a purchase
Sell a digital product or plan with Stripe-hosted Checkout, then unlock access when the webhook confirms payment.
Add payments with Stripe Checkout to this app. - Server route creates a Checkout Session for [PRODUCT/PRICE ID] with success and cancel URLs. - Webhook route verifies the Stripe signature using the RAW request body and the endpoint's whsec_ secret. - On checkout.session.completed, mark the user as paid in the database (idempotent: handle duplicate events). - Never trust the success URL alone to grant access. - Use test mode keys; give me steps to test with the Stripe CLI (stripe listen / stripe trigger). - List the env vars and the dashboard steps for going live.
Tips
- Keep separate webhook secrets for local (Stripe CLI), test, and live endpoints.
Works with: Cursor, Claude Code, Codex, Replit, Lovable, Bolt, v0. Last reviewed 2026-11-13.