Skip to main content

Stripe Checkout

Setup for Stripe-hosted Checkout, the webhook, and plan activation.

Backend

Set these variables in backend/.env or backend/.env.production:

STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
FRONTEND_APP_URL=http://localhost:5173
STRIPE_PRICE_EARLY_ACCESS=price_...
STRIPE_PRICE_FOUNDERS=price_...

STRIPE_PRICE_EARLY_ACCESS and STRIPE_PRICE_FOUNDERS must be real Stripe Price IDs from your Dashboard.

Webhook

Create a Stripe webhook endpoint:

https://your-domain.com/api/stripe/webhook

Subscribe it to these events:

  • checkout.session.completed
  • checkout.session.async_payment_succeeded
  • checkout.session.async_payment_failed
  • checkout.session.expired

Database

Apply the Prisma migration for stripe_checkout_sessions, then regenerate the Prisma client. Follow Database Migrations — the standard Prisma commands do not work against this database.

Frontend flow

  1. An authenticated user clicks a paid plan.
  2. The backend creates a Stripe Checkout Session.
  3. The frontend redirects to Stripe-hosted Checkout.
  4. Stripe returns the user to /profile/settings.
  5. The frontend confirms the session, the webhook finalizes access, and the current-plan card updates.

Notes

  • Free-plan activation still happens instantly, without Stripe.
  • Get Agent routes users to plan selection instead of opening a custom payment form.
  • The old Stripe Elements components have been removed.