Documentation

Stripe subscriptions

Checkout, portal access, plan gating, and webhook sync are wired end-to-end for the Starter/Foundation/Accelerate plans defined in `STRIPE_PLANS`.

Plan config

Update pricing, limits, and feature flags in `STRIPE_PLANS`. The object feeds both the marketing site and the dashboard gating helpers.

Relevant files

  • src/lib/stripe.ts — Stripe config

Customer journey

Users start checkout via `/dashboard/billing`, hit `/api/stripe/checkout`, and manage their subscription in the portal triggered by `/api/stripe/portal`.

Relevant files

  • src/app/dashboard/billing/page.tsx — Billing page
  • src/app/api/stripe/checkout/route.ts — Checkout route
  • src/app/api/stripe/portal/route.ts — Portal route

Keep Prisma in sync

The webhook handler listens for checkout completion, subscription updates, and cancellations, ensuring `User` records always carry the latest customer IDs and plan metadata.

Relevant files

  • src/app/api/stripe/webhook/route.ts — Webhook handler
  • prisma/schema.prisma — User model fields