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

PlanPriceStripe variablePublic visibility
Solo€49/monthSTRIPE_SOLO_PRICE_ID or legacy STRIPE_PRICE_SOLOShown publicly.
Growth€149/monthSTRIPE_GROWTH_PRICE_ID or legacy STRIPE_PRICE_GROWTHShown publicly.
Enterprise€499/monthSTRIPE_ENTERPRISE_PRICE_ID or legacy STRIPE_PRICE_ENTERPRISEShown publicly.
Internal Live TestNot implementedSTRIPE_PRICE_INTERNAL_TESTNot found in current code. Treat as optional/planned, not a live plan.

Checkout Lifecycle

  • User selects a plan on /pricing or /checkout/[plan].
  • components/CheckoutButton.tsx posts { 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_sessions with status created.
  • Stripe redirects the user to Checkout. On success, Stripe sends checkout.session.completed to 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 groupStatuses
Active accessactive, trialing
Inactive or restrictedpast_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

AreaState
Stripe Checkout routeImplemented in /api/checkout/stripe.
Stripe webhook lifecycleImplemented in /api/webhooks/stripe and compatibility /api/stripe/webhook.
Billing portal routeImplemented in /api/billing/portal.
Live-mode commercial readinessRequires production verification in the target Stripe account and Vercel environment before public launch if not already proven.
Internal test planNot 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.