Billing & Subscriptions
Billing & Subscriptions¶
Huitzo bills two independent things: rate limits, carried by the acting tenant's plan, and credits, bought as pay-as-you-go top-ups. They are not the same control and one does not buy the other — a top-up raises what you can spend, not how fast you may call.
There is no self-serve tier purchase: POST /api/v1/billing/checkout and
POST /api/v1/billing/change-plan were removed with the legacy membership model
(migration saas_0014). A member with a pre-existing Stripe subscription keeps
it and manages or cancels it through the Customer Portal. Team plans are
provisioned by platform staff.
See the billing reference and the founder-approved v1 decisions.
Plans, not tiers¶
The Free/Starter/Pro/Scale membership tiers are gone: D-024 CR27 deleted the
tier ladder, its public GET /api/v1/billing/plans listing and the tenant tier
column (ADR-041 C7).
Every tenant is on a plan from PLAN_CATALOG; a tenant without a plan row is
payg. Plans, prices and allowances are in the
billing reference. Credits are bought as PAYG
top-ups: see credits.md.
Personal membership operations¶
| Operation | Surface |
|---|---|
| Read billing status (whether a Stripe customer is on file) | GET /api/v1/billing/status |
| Read current-period usage | GET /api/v1/billing/usage |
| Manage payment method or cancellation | POST /api/v1/billing/portal |
| Receive Stripe events | POST /api/v1/billing/webhook |
| Read the wallet balance | GET /api/v1/wallet |
| Buy credits | POST /api/v1/wallet/topup/checkout |
Removed with the legacy membership model (migration saas_0014):
POST /api/v1/billing/checkout and POST /api/v1/billing/change-plan. There is
no in-app plan purchase or switch, and no tier ladder (D-024 CR27); credits are
bought as PAYG top-ups. A member with a pre-existing subscription manages or
cancels it through the Customer Portal.
The portal and top-up responses provide Stripe-hosted URLs. A plan card or price listing is informational; it is not dashboard commerce.
Stripe webhook handling reconciles wallet top-up settlement, subscription changes and deletion, and invoice payment success or failure. If a webhook or checkout fails, use the membership operations runbook.
Usage and limits¶
Two different things are reported, by two surfaces:
- Quotas.
GET /api/v1/billing/usagereports quota-oriented usage: command counts, seat counts and pack counts where those quotas apply. - Metered usage, charged in credits. With
HUITZO_SAAS_BILLING_ENABLEDon, compute seconds, LLM tokens and text-to-speech characters are metered and charged to the wallet: reserved before the work, settled after, and refused with 402 when the wallet cannot cover it (credits: usage ledger). The wallet's usage and cost views are under/api/v1/wallet/usage(usage and cost projection). A Team workspace reads its remaining allowance atGET /api/v1/billing/allowance.
Storage, database and integration-call usage are not billed.
Team plans¶
Team plans (team_s, team_m, team_l) are monthly subscriptions for
businesses, provisioned by platform staff and never bought in the app. Each
includes a monthly usage allowance, drawn before the workspace's credits
(billing reference: Team plans,
Team onboarding runbook). They replaced the
retired Enterprise plans (ADR-041 C7).
- Invoicing. A
contractplan is invoiced by Huitzo Inc. outside the platform. The Stripe invoice rail exists behindHUITZO_TEAM_INVOICE_RAIL_ENABLEDand is off by default. - Lapse. Suspension for non-payment is automatic under the plan's grace terms (Team lifecycle); it is not a manual action.
- Trials. Staff can start a Team trial with a coupon (Team trials).
What ships dark, and what is not built¶
Every D-024 money path is in the code and off by default. Whether a deployment offers it depends on its flags; the order to turn them on is the D-024 flag ladder, and the row-by-row status is in the billing reference.
| Shipped, behind a flag | Flag |
|---|---|
| PAYG wallet and credit top-ups | HUITZO_PAYG_ENABLED |
| Usage charged in credits, fail-closed | HUITZO_SAAS_BILLING_ENABLED (always the acting workspace's wallet) |
| Auto-recharge | HUITZO_PAYG_AUTO_RELOAD_ENABLED |
| Promotional credits and Team trials by coupon | HUITZO_COUPON_CREDITS_ENABLED |
| Team overflow: invoiced usage blocks, the tenant card | HUITZO_TEAM_USAGE_BLOCKS_ENABLED, HUITZO_TEAM_CARD_OVERFLOW_ENABLED |
| Tax collected through Stripe Tax; peso top-ups | HUITZO_STRIPE_TAX_ENABLED, HUITZO_MXN_PRESENTMENT_ENABLED |
| Staff refund of an untouched paid lot within 30 days | HUITZO_PAYG_REFUNDS_ENABLED |
| Chargeback clawback | HUITZO_DISPUTE_CLAWBACK_ENABLED |
| Pack prices and the records-only platform fee | HUITZO_PACK_PRICING_ENABLED |
Coupons themselves (signup, joining or creating a workspace) have no flag (coupons runbook).
Not built: developer payouts, Stripe Connect and creator revenue splits;
self-serve Team signup; a customer-facing refund API (refunds are a staff
action); the partner_managed plan; postpaid billing of any kind
(billing reference: not implemented).