Slices
Billing
Organization plans on Stripe, with checkout, the portal, feature gates and metered usage.The billing slice bills organizations, not people. A plan belongs to
the tenant: every member gets what it unlocks, and it outlives the admin
who bought it. It requires orgs (which brings auth) and adds no
dependency: Stripe is called over global fetch and webhook signatures
are checked with node:crypto.
No surface can decide whether an app takes money, so billing is asked for
outright (the api surface is the exception and requires it):
Run supabase/billing.sql after init.sql and orgs.sql, and set
STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET.
Last updated October 18, 2026- stripe, when STRIPE_SECRET_KEY is set: Stripe Checkout; the webhook mirrors the subscription.
- mock, when no key, not production: activates the plan in the database directly.
- off, when no key, NODE_ENV=production: refuses with 503.
- GET /api/orgs/[org]/billing — requireOrg: any member sees the plan.
- POST /api/orgs/[org]/billing/checkout — requireOrgAdmin, refused while a plan is active.
- POST /api/orgs/[org]/billing/portal — requireOrgAdmin; in mock mode, cancels.
- POST /api/webhooks/stripe — Stripe's signature.
Edit this page on GitHub