Frontend Billing And Stripe
Frontend Billing And Stripe
Source of truth:
- Generated billing hooks:
frontend/generated/api/billing/billing.ts - Billing UI:
frontend/app/(app)/billing/ - Billing feature gating:
frontend/hooks/use-billing.ts
Billing Endpoints Used
GET /api/v1/billing/subscription-summary/GET /api/v1/billing/active-plans/POST /api/v1/billing/checkout-session/GET /api/v1/billing/checkout-session-status/POST /api/v1/billing/portal-session/
Typical Checkout Flow
- Fetch plans (
active-plans) to display pricing. - Call
createCheckoutSessionwith apriceId. - Redirect/embed Stripe checkout.
- On return page, call
checkoutSessionStatusto confirm entitlement deterministically.
Stripe Publishable Key
Frontend requires a publishable key for embedded checkout:
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
See usage in frontend/app/(app)/billing/checkout/page.tsx.
Local Dev Notes
If seed data is used (SEED.md), a tenant can be entitled via tenant.state == active even without a Stripe subscription object. Expect billing UI to reflect that nuance (summary vs actual Stripe objects).
Last updated June 21, 2026