Phase 14, part 1: plans, each team's account, and their limits
The multi-tenant edition's plans (Free and Paid as decided, or a plans file) and each team's billing account, with a 14-day trial of Paid. A team's plan caps what its people and agents may change: modules outside it stay readable, a lapsed team changes nothing, and agents, Market entries, crawls and background jobs keep to it. Without a Stripe key, no billing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3212,6 +3212,33 @@ Open questions for this phase:
|
||||
- Is there an annual plan (for example two months free)?
|
||||
- Tax: Stripe Tax?
|
||||
|
||||
**Built 2026-11-26** on branch `phase14`, a commit per part. Billing runs
|
||||
only with `SUPERMARKET_STRIPE_KEY` set (with its webhook secret and the
|
||||
paid plan's price); without it, a multi-tenant install gives every team
|
||||
everything. The two open questions don't block: the plans file takes a
|
||||
yearly price beside the monthly one, and `tax: true` turns Stripe Tax on in
|
||||
Checkout; both are off until set.
|
||||
|
||||
**Part 1 built 2026-11-26.**
|
||||
- `internal/billing`: plans (the decided Free and Paid built in, or a YAML
|
||||
file, `SUPERMARKET_PLANS`; Stripe's prices from it or
|
||||
`SUPERMARKET_STRIPE_PRICE`, `_PRICE_YEAR`, `_PRICE_STORAGE`), and each
|
||||
team's account (schema 44, the platform's `billing`: plan, status,
|
||||
trial's end, Stripe's customer and subscription, seats, storage blocks,
|
||||
the period's end, past due since, and more for later parts; and
|
||||
`stripe_events`, each event handled once).
|
||||
- A new team starts a 14-day trial of Paid. Its plan now (`Effective`): the
|
||||
plan subscribed to while trialing, active or past due under 14 days;
|
||||
past due longer, the same but read-only; otherwise Free.
|
||||
- Enforced: a membership gets the plan as a cap (`users.Membership.Cap`,
|
||||
which limits admins too): a module outside the plan can be read, with
|
||||
its data, but not changed, and says it isn't in the plan; a read-only
|
||||
team changes nothing but its billing (*the team's subscription has
|
||||
lapsed*), and its agents are refused. Background jobs skip modules
|
||||
outside the plan, and everything but housekeeping for a lapsed team.
|
||||
Agents (Free 1, Paid 5), Market entries (Free 10) and the SEO audit
|
||||
(Free 500 pages weekly, Paid 10,000 daily) follow the plan.
|
||||
|
||||
#### Order
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user