AgentFlow Enterprise Docs
Billing Lifecycle
Self-serve plans use Stripe Checkout and webhook-backed Supabase subscription state. Active access is based on `active` or `trialing` status.
Plans
| Plan | Price | Stripe variable | Public visibility |
|---|---|---|---|
| Solo | €49/month | STRIPE_SOLO_PRICE_ID or legacy STRIPE_PRICE_SOLO | Shown publicly. |
| Growth | €149/month | STRIPE_GROWTH_PRICE_ID or legacy STRIPE_PRICE_GROWTH | Shown publicly. |
| Enterprise | €499/month | STRIPE_ENTERPRISE_PRICE_ID or legacy STRIPE_PRICE_ENTERPRISE | Shown publicly. |
| Internal Live Test | Not implemented | STRIPE_PRICE_INTERNAL_TEST | Not found in current code. Treat as optional/planned, not a live plan. |
Checkout Lifecycle
- User selects a plan on
/pricingor/checkout/[plan]. components/CheckoutButton.tsxposts{ plan }to/api/checkout/stripe.- The checkout route requires a signed-in user, required Supabase env vars, service-role key, Stripe secret key, and the selected plan price id.
- The server ensures an organization and creates a Stripe Checkout Session in subscription mode.
- The checkout session is inserted into
checkout_sessionswith statuscreated. - Stripe redirects the user to Checkout. On success, Stripe sends
checkout.session.completedto the webhook endpoint. - The webhook resolves the checkout session, upserts customer/subscription rows, marks checkout completed, writes audit/billing events, and the dashboard reads subscription status.
Customer Portal and Statuses
POST /api/billing/portal creates a Stripe Billing Portal session for signed-in users with a known Stripe customer id. Stripe handles payment method changes, cancellation, invoice/payment management, and subscription updates in the hosted portal.
| Status group | Statuses |
|---|---|
| Active access | active, trialing |
| Inactive or restricted | past_due, unpaid, canceled, incomplete, incomplete_expired, paused |
invoice.payment_failed refreshes subscription state and can trigger payment-failure email behavior when SES is configured. Access checks in lib/usage.ts only treat active and trialing as active.
Implemented vs Requires Verification
| Area | State |
|---|---|
| Stripe Checkout route | Implemented in /api/checkout/stripe. |
| Stripe webhook lifecycle | Implemented in /api/webhooks/stripe and compatibility /api/stripe/webhook. |
| Billing portal route | Implemented in /api/billing/portal. |
| Live-mode commercial readiness | Requires production verification in the target Stripe account and Vercel environment before public launch if not already proven. |
| Internal test plan | Not implemented in inspected code. |
These docs describe implementation readiness and configuration. They are not a SOC 2, ISO 27001, penetration test, or contractual SLA claim.