POST /v1/organizations/{organizationId}/billing/projects/{projectId}/preview
Previews a change on the selected project’s subscription in the supplied category: a fixed-charge quantity change, or a plan change with the held fixed charges it carries over. Prices the change by the billing engine exactly as making it would bill it now: dueNow is that invoice, with taxes and the payer’s credits applied. A purchase bills each unit it adds, even after a release this period. A release bills nothing; releasing a prorated charge credits its unused days to the organization’s credit. dueLater is what the change leads to that is billed later instead, and nextCharge what is charged in advance at the next period start. change says what the change does by its kind: for a fixed-charge change, pass change.quote on with the purchase so it is refused if the price or period no longer hold. This operation does not change billing. An upgrade bills the replaced plan’s usage to date and the new plan from now, less the replaced plan’s unused time; change says when it applies and which held fixed charges the target does not sell: released first for a change that applies now, released with a downgrade when it applies. additions quotes what is added once an upgrade applies, each billed when it is added, in dueLater and outside dueNow. Supply both organizationId and projectId; the organization must pay for the project.
- TypeScript
- Python
- Rust
- Go
TypeScript
Parameters
string
required
string
required
The project being billed.
Body
One of: BillingPreviewFixedChargeChangestring
required
Category slug, e.g. analytics or messaging.
FixedChargeChange
required
A quantity change made now, as a purchase or release makes it.
array of FixedChargeAddition
Fixed charges added once an upgrade applies, each billed when it is added rather than with the upgrade. Priced as if added now on the target plan and returned in dueLater, outside dueNow. Each must be sold by the target plan and named once.
string
required
Category slug, e.g. analytics or messaging.
string
required
Plan to change to, as a purchase of it changes it.
Returns
200 What the change would bill. PreviewProjectChangeResponse
integer | null
required
The payer’s credit balance once dueNow is charged: the credit the change issues included, less what dueNow uses. In dueNow’s currency. Null when the change charges nothing now (a downgrade).
BillingChangeEffect
required
What the change does beside what it bills, by the kind of change requested: fixed_charge for a fixed-charge change, plan_change for a plan change.
BillingPreviewDeferred
required
Billed later rather than with dueNow: one line per plan change addition, billed when it is added and priced as if added now. Before taxes; the balance left after dueNow applies to it first. nextCharge already includes it. No lines when nothing is billed later.
BillingPreviewInvoice
required
Charged when the change is made, priced as the change bills it. No lines when it charges nothing now.
BillingNextCharge | null
required
What is charged in advance at the next period start for what is held after the change. Usage and a minimum commitment are billed after the period. Null when nothing is, or the subscription ends first.
string
required
The IANA time zone the payer is billed in, e.g. America/Los_Angeles. Billing periods start and end at its midnights, so read their calendar dates in it.