Skip to main content

Billing

📄️Start a Stripe Checkout session for an existing instance (subscription upgrade or one-time bundle top-up)

For a prepaid top-up, any existing Stripe Customer Balance credit on this instance's account (see docs/billing.md's 'Self-serve billing management' section) is applied first — `appliedCreditCents` in the response reports how much. If it fully covers the bundle price, `checkoutUrl` is null (credits were already granted synchronously, nothing to pay); if it only partially covers it, the Checkout Session charges just the discounted remainder and the credit is consumed once that payment is confirmed by the webhook.

📄️Start a Stripe Billing Portal session for this instance's customer

Returns a URL to Stripe's own hosted Billing Portal, where the customer can update their payment method, view/download past invoices, and manage or cancel their subscription directly with Stripe — this app never handles card details itself. Requires this instance to already have a Stripe customer (`Instance.stripeCustomerId`, set the first time one is needed — a bundle purchase, a fixed-plan checkout, or a credit conversion — independent of whether a subscription exists); a `400` here means neither has happened yet. A `400` can also mean the Stripe account has no Customer Portal configuration yet (test-mode accounts get a default one automatically; live accounts need one created once — see docs/billing.md) — Stripe's own rejection message is passed through in that case.

📄️Stripe Customer Balance credit available on this instance's account

Reads Stripe's own Customer Balance (docs/billing.md's 'Self-serve billing management' section) — never a balance tracked in our own database. This credit is applied automatically to whatever this customer is charged next (a subscription renewal, a cycle switch's prorated invoice, etc). Always `{ creditCents: 0, currency: <platform currency> }` (not an error) for an instance that has never had a Stripe customer at all (`Instance.stripeCustomerId` unset — no bundle purchase, checkout, or credit conversion has happened for it yet).