Skip to content

Plans and Billing

This is for the operators of an instance that sells plans to its organizations. An instance that sells none leaves Billing:Enabled off: an organization’s plan is then a name in the console, and nothing is counted against anything.

  • A plan is a row you keep in the console, never a setting and never part of the product: its name, how it is sold, its prices, what it includes and its AI allowance. The product ships with no plan and no price.
  • Nothing is a price until the table is approved. Until an operator administrator approves the price table, the public pricing page shows no plan and no figure, and no checkout starts. Any later change to a plan or a pack takes the approval away until the table is approved again.
  • Limits on people and models never refuse anything. They produce a notice for the organization’s administrators at 80 percent and past the limit, and the organization shows first under Organizations on a Plan.
  • The AI allowance is the one hard stop: at the month’s allowance or the day’s cap the assistant stops for that organization on the instance’s AI account, until the next month or day or until it uses an account of its own.
  • An organization gets a plan in one of two ways: you set it against an invoice, or its administrator buys it by card on Stripe’s own page.

What the organization’s administrators see is in Plan and usage.

Set Billing:Enabled to true. The workspace then has Plan and Usage for administrators, the console has Plans, and the pricing page at /pricing answers. See Settings for the rest.

Plans in the console (/?area=plans) lists every plan and pack. Every change asks for a Reason, which the audit keeps with the figures before and after.

A plan has:

Field What It Is
Name, Code The name people see, and a code of lower-case letters, digits and dashes. The code is fixed once the plan is made: what organizations bought names it
Sold by the Seat Each seat brings everything the plan includes once, between the least and the most seats you set. Otherwise the plan is one fixed size
Bought by Checkout An administrator can buy it by card on Stripe’s page. Left off, the plan is given only against an invoice
Price a Year, Price a Month Typed in dollars. Leave one empty and the plan is not sold for that period; leave both empty for a plan that is quoted
Reviewers, Creators, Models What the plan includes. Leave one empty for no limit. One Pool of Paid People counts reviewers and creators together
AI Allowance a Month, Daily Cap In dollars of what the assistant’s calls cost on the instance’s AI account. A daily cap of 0 is no daily cap; an allowance of 0 means the plan includes none
Active Whether the plan can be bought or given. Switch a plan off rather than deleting it once an organization has it
Listed Whether it is shown on the public pricing page

A pack adds to any plan that takes packs: reviewers, creators, models, or more AI allowance a month.

What an organization already bought keeps what it was bought with. Changing a plan changes it for the next buyer; an organization’s limits change only when its plan or its seats do, or when you set them.

Import Price Table takes a JSON file holding plans and packs in the same shape the console sends, makes each one or changes it when its code is there already, and does all of it or none. Nothing is deleted. Keep the approved table as such a file outside the instance, so that it can be read, signed off and entered in one step.

The Price Table card says whether the table is approved, by whom and when.

  • Approve Price Table is for an operator administrator. It approves the table exactly as it stands: if a plan changed after you opened the page, the approval is refused and the page is read again, so that nothing is approved unseen. The audit keeps every figure that was approved.
  • Withdraw Approval takes it back without changing anything.
  • Any change to a plan or a pack takes the approval away. The dialog says so before you save. The database keeps this rule by itself, whoever writes to it.

While the table is not approved, the pricing page shows no plan and no figure and says that plans are arranged directly, the workspace offers no plan to buy, and a checkout is refused. Plans you set against an invoice are not affected: an invoiced customer’s plan was agreed with them directly.

For a customer who pays by ACH, wire or check under a contract, set the plan yourself: on the organization’s row, or from Organizations on a Plan, open Plan.

  1. Choose the Plan, the Seats where it is sold by the seat, and whether the term is counted by the year or the month.
  2. Set the term’s Start and End. Left empty, the term is a year from today.
  3. With Custom Limits, type this customer’s own reviewers, creators, models and AI allowance; an empty one is no limit. Without it the plan’s own figures apply.
  4. Add any Packs, with how many of each.
  5. Type the Purchase Reference (the purchase order or contract), the day it was Invoiced, and how it is Paid: ACH, wire, check, card or other.
  6. Give a Reason and choose Set Plan.

Payment itself happens outside the product: this records that it was invoiced, and under which reference. End Plan ends an invoiced plan today, for a contract that was not renewed or a plan set by mistake.

A trial that gets a plan stops being a trial for good: its end and its day of deletion are cleared, and it keeps everything it made. An organization that pays by card cannot be given a plan here until its subscription has ended in Stripe, which keeps its plan in step.

The list shows every organization with a plan and where it stands: the ones past a limit first, then the ones near one, then by the day the term ends. A limit that is passed blocks nothing. This is the list of what to settle at renewal.

Paying by card works the way it does in the DigitalPrez Portal. The customer pays on Stripe’s own page; Stripe tells the instance with a signed webhook; the product never sees a card or account number and its pages load nothing from Stripe.

You need two values, and both must be set or there is no checkout:

Setting What It Is
Stripe:SecretKey An API key: sk_test_… while testing, a restricted rk_live_… key in production
Stripe:WebhookSecret The signing secret (whsec_…) of the webhook that points at this instance

Put them in the instance’s secret settings, never in a message or a ticket. Use a Stripe account of this product’s own: an account shared with another application sends each one the other’s events.

Create an event destination in Stripe for your account, with the payload format Snapshot, at https://<your workspace host>/api/stripe/webhook, for these events:

checkout.session.completed
customer.subscription.created
customer.subscription.updated
customer.subscription.deleted
invoice.paid
invoice.payment_failed

To check that the keys were loaded, post an empty body to the webhook: 400 means they were (the signature did not verify), 404 means either value is still missing.

Terminal window
curl -s -o /dev/null -w '%{http_code}\n' -X POST -H 'Content-Type: application/json' -d '{}' https://<your workspace host>/api/stripe/webhook

In production, make a restricted key with these permissions and everything else None:

Resource Permission Used For
Customers Write One Stripe customer for each organization
Products Write A product for each plan and pack, named from its code
Checkout Sessions Write The payment page
Subscriptions Write Reading a subscription, and adding seats and packs to it
Invoices Read The invoices shown under Payment and Invoices, and the price of an addition before it is charged
Customer portal Write Stripe’s pages for payment methods, billing details and cancelling

The labels in Stripe’s dialog may differ slightly.

  • A checkout is a subscription priced from the plan’s row at that moment, in cents, on a product of this instance’s own (nbf_plan_<code>, nbf_pack_<code>). There is no second price list in Stripe to keep in step.
  • Only Stripe’s signed notice gives a plan. Coming back from the payment page proves nothing.
  • A notice is applied once, however often it is delivered, and whatever order notices arrive in: each one makes the instance read the subscription again as Stripe holds it now.
  • Adding seats or packs is charged at once for the rest of the term to the payment method on file. If the charge fails, nothing is added.
  • Payment methods, billing details, the tax id and cancelling are on Stripe’s customer portal, which the instance configures once: cancelling lets the plan run to the end of its term, and changing the plan is not offered there.
  • A failed renewal shows as Payment Due and blocks nothing while Stripe retries. When Stripe ends the subscription, the plan has ended.

Refunds and disputes are handled in Stripe’s dashboard.

With a test key, the workspace and the console show a Test Mode badge beside every payment button, and no money moves. Use Stripe’s test cards, and forward test webhooks to a development instance with the Stripe CLI:

Terminal window
stripe listen --events checkout.session.completed,customer.subscription.created,customer.subscription.updated,customer.subscription.deleted,invoice.paid,invoice.payment_failed --forward-to http://localhost:5080/api/stripe/webhook

It prints the signing secret to set as Stripe:WebhookSecret.

Sales tax is calculated by Stripe’s tax service, on only when Tax:Enabled is true. Prices are before tax, and tax is added at checkout and on renewals.

  1. In Stripe, under Tax, finish the settings and add a registration for each place you are registered to collect tax. Stripe calculates tax only there, and answers zero everywhere else.
  2. Set Tax:ProductCode if the product is not sold as software as a service for business use, which is the default (txcd_10103001).
  3. Set Tax:Enabled to true.

The checkout asks for the buyer’s billing address and lets them add a tax id. Where to register and how the product is taxed are decisions for you and your accountant.

A term that ends is followed by Billing:GraceDays days in which everything works as before, with a notice. What follows them is Billing:ReadOnlyAfterGrace:

  • Off, the default: the notice stays, and nothing is blocked.
  • On: the organization’s people open and export, and change nothing, until it has a plan again, as after a trial’s end. Signing in, a person’s own account, support access and Plan and Usage stay open, so renewing is always possible.

Nothing of an organization is ever deleted because its plan ended.

Each call on the instance’s own AI account is costed in dollars at the price of the model that answered it, and counted against the organization’s allowance for the month and its cap for the day (UTC). A model the built-in price table does not know is counted at the dearest price, so an allowance ends early, never late. Billing:AiCostPercent scales what is counted, for a vendor price that rose since the table was written.

An organization with no plan keeps the instance’s own allowance in tokens, as set under AI Account. An organization on its own AI account is not metered.

Setting Default
Billing:Enabled: whether this instance sells plans false
Billing:NearPercent: the share of a limit from which its notice shows 80
Billing:ReviewerRoles: the roles that make a person a reviewer, separated by spaces assessor approver
Billing:CreatorRoles: the roles that make a person a creator when they are no reviewer author central curator administrator
Billing:AiCostPercent: what is counted against an AI allowance for each dollar a call costs, in percent 100
Billing:RenewalNoticeDays: days before a term’s end from which administrators are told 30
Billing:GraceDays: days after a term’s end in which everything works as before 30
Billing:ReadOnlyAfterGrace: whether an organization is read-only after those days, until it has a plan again false
Billing:SalesAddress: where Talk to Us leads, an address that starts with https:// or mailto: none
Stripe:SecretKey, Stripe:WebhookSecret: card payment; both, or there is no checkout none
Tax:Enabled, Tax:ProductCode: sales tax by Stripe’s tax service, and Stripe’s tax code for what is sold false, txcd_10103001

The workspace’s own address, Platform:WorkspaceAddress, must be set: it is where Stripe sends a person back after the payment page.