Billing
Stripe-hosted runtime plans, entitlements, and operator setup.
Billing
Matrix OS hosted runtime billing is backed by Stripe Billing. Clerk remains the identity provider, but subscription checkout, coupons, tax, the customer portal, and webhooks are handled by Stripe.
Hosted Runtime Plans
| Plan | Monthly | Annual | Default machine | Included machines |
|---|---|---|---|---|
| Starter | $14 | $140 | Hetzner CPX22, 2 vCPU, 4 GB RAM, 80 GB disk | 1 |
| Builder | $19 | $190 | Hetzner CPX32, 4 vCPU, 8 GB RAM, 160 GB disk | 1 |
| Max | $49 | $490 | Hetzner CPX52, 12 vCPU, 24 GB RAM, 480 GB disk | 1 |
There are no hosted runtime trials. A signed-in user can explore account surfaces, but a hosted Matrix computer requires active billing before provisioning.
Entitlements
Stripe subscription webhooks project every subscription independently into billing_subscriptions. Each row carries the Clerk user id and runtime slot from signed Stripe metadata. Provisioning and routing authorize that exact (clerk_user_id, runtime_slot) projection rather than a user-wide slot count. billing_entitlements remains a derived coarse summary for legacy and account-level views; it is not the authorization source for one computer.
The platform allows runtime proxying and provisioning while that computer's subscription is active, and during a three-day grace period after a recoverable billing failure. After grace ends, Matrix blocks only that runtime slot without deleting owner data or machines. Other computers and subscriptions remain unaffected.
Internal engineers can receive a production or staging override entitlement for testing plan changes without paying. Overrides are audit records with an expiry or revocation path; they must not delete, downgrade, or recreate a user's existing machines.
Machine resize uses the same entitlement allowlist as provisioning. A running VPS may move only to a server type currently allowed by the effective entitlement. The resize path changes the Hetzner server type in place with disk growth disabled, so billing downgrades can move CPU/RAM down without replacing the machine or deleting owner data.
Additional Computers
Every additional computer purchases one standard Starter, Builder, or Max subscription through Stripe Checkout under the user's existing Stripe customer. Checkout and subscription metadata include clerk_user_id, matrix_runtime_slot, and the selected region. The Customer Portal manages existing subscriptions but does not purchase another computer.
Do not configure an extra-runtime Price or a focused Customer Portal subscription-update flow. Storage and future Hetzner-backed add-ons remain separate product decisions. Do not hardcode Hetzner prices into Stripe plan names; keep provider cost data in the Matrix runtime catalog so Hetzner price changes can be updated without renaming public plans.
Stripe Setup
Create recurring monthly and yearly Stripe Prices for the three plans. The same six Prices are used for first-time and additional-computer Checkout. Configure promotion codes in Stripe for launch discounts, time-limited percentage discounts, pay-X-get-Y campaigns, and referrals.
Required platform environment:
| Variable | Notes |
|---|---|
MATRIX_BILLING_PROVIDER=stripe or MATRIX_STRIPE_BILLING_ENABLED=true | Enables Stripe-backed entitlement enforcement. |
STRIPE_SECRET_KEY | Restricted key with checkout, portal, customer, subscription, and webhook needs. |
STRIPE_WEBHOOK_SECRET | Webhook signing secret for /billing/webhooks/stripe. |
STRIPE_PRICE_MATRIX_STARTER_MONTHLY / STRIPE_PRICE_MATRIX_STARTER_ANNUAL | Starter Price IDs. |
STRIPE_PRICE_MATRIX_BUILDER_MONTHLY / STRIPE_PRICE_MATRIX_BUILDER_ANNUAL | Builder Price IDs. |
STRIPE_PRICE_MATRIX_MAX_MONTHLY / STRIPE_PRICE_MATRIX_MAX_ANNUAL | Max Price IDs. |
PLATFORM_PUBLIC_URL | Used to build checkout and portal return URLs. |
Production Cloud Run deployments read the Price IDs from Secret Manager. The required secret names are:
| Environment variable | Secret Manager name |
|---|---|
STRIPE_PRICE_MATRIX_STARTER_MONTHLY | stripe-price-matrix-starter-monthly |
STRIPE_PRICE_MATRIX_STARTER_ANNUAL | stripe-price-matrix-starter-annual |
STRIPE_PRICE_MATRIX_BUILDER_MONTHLY | stripe-price-matrix-builder-monthly |
STRIPE_PRICE_MATRIX_BUILDER_ANNUAL | stripe-price-matrix-builder-annual |
STRIPE_PRICE_MATRIX_MAX_MONTHLY | stripe-price-matrix-max-monthly |
STRIPE_PRICE_MATRIX_MAX_ANNUAL | stripe-price-matrix-max-annual |
| The signed-in pre-VPS path defaults to Builder monthly checkout. Missing price | |
| secret access should block deployment rather than letting new users reach a | |
| broken billing gate. |
Webhook events to subscribe:
customer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deleted
Stripe Checkout uses automatic tax, promotion codes, and an idempotency key derived from the persisted checkout attempt. The customer portal should remain enabled so users can update payment methods, apply supported coupons, and manage existing subscriptions through Stripe-hosted flows.
How is this guide?