Skip to content

stripe

Stripe: one way an org pays, for credits, which never asks it anything.

On this page 7
TypeScript
import { stripe } from "@copilotz/billing";

What it keeps

It keeps nothing of its own.

What it lets callers do

Of its 4 Actions, people may call 2; agents, contacts and someone signed out may call none.

ActionPersonAgentContactAnyoneKeyRoutineWhat it does
billing.checkoutyesnononononoA page where the org buys credits, or subscribes to a plan.
billing.portalyesnononononoA page where the org manages what it pays: card, invoices, cancelling.

An agent works for a person, and calls what both may. A key calls only what its scope names. A routine is work done for a person, which they set going.

Only the app's own code calls billing.sellable and stripe.seats: its plugins, its schedules and the system.

Where it shows

It has no Views: it shows nowhere on its own.

  • What it adds to resources: billing (pay).

What it needs

You set it in resources.stripe: 3 settings are required.

SettingTypeRequiredWhat it is
stripe.sellersRecord<string, Seller>yesThe accounts, by name, and the one that sells unless a country says otherwise.
stripe.sellerstringyesThe accounts, by name, and the one that sells unless a country says otherwise.
stripe.urlstringyesThe app's address, for coming back from checkout.
stripe.livebooleannoReal money: a test mode's customers and subscriptions don't carry over.
stripe.orgsobjectnoWhere the webhook finds an org's runtime, in an app of many (the directory's: its runtimes); without it, the webhook's own runtime.

It also reads billing and org, resource kinds the app and other plugins fill.

What it requires

The runtime doesn't start without credits: add it too.

It ships in a package of its own, @copilotz/billing@1.0.0-rc.34, for copilotz 1.0.0-rc.34: install it beside copilotz.

What it does on its own

Some of its work starts without a caller: an event, or the time.

  • stripe.seats calls stripe.seats, cron 40 0 * (UTC). Brings a subscription's seats to the org's people, each day.

Listing

It keeps every listing rule.