BillingPlan
ResponseWhat to bill whom, every period: lines with fixed amounts, formulas over object properties and meter consumption, or allocations of a cost. A plan keeps one id for life: a change that would alter periods already billed becomes a new revision (revision) from effective_from, and each run bills the revision in force.
Returned in responses. Its enums are open: tolerate values not listed here, which later versions may add.
Attributes
31How often a run bills. New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) monthly, quarterly, yearly
object_type (every in-use object of a type) or partners (a list of contacts). New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) object_type, partners
First period this revision bills; null for the first revision (from start_period).
For partners plans, the contacts billed; empty when omitted names contacts.
Lines, in invoice order.
22 attributes of each item
fixed, formula or allocation (see BillingPlanLineInput). New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) fixed, formula, allocation
The price from this line (manual) or from the item (article). New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) manual, article
fixed lines with a manual price: net price per unit.
Who the line bills.
2 attributes of recipient_filter
Every recipient of the plan, or only the listed ones. New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) all, selected
What a run does when a consumption the line uses has no reading. New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) block, skip_line, estimate
How a negative consumption is billed. New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) zero, negative
Bill only objects whose boolean property has this value.
Bill only in periods where the plan's boolean variable has this value.
Dimension values on the line.
For object_type plans, the contact properties that name the payer, in order.
Whether lines that come to zero appear on invoices. New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) hide, show
The currency (ISO 4217) of every invoice the plan bills; each converts into the book currency at the European Central Bank rate of its posting date.
Values formulas refer to as var.<key>.
14 attributes of each item
number or boolean. New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) number, boolean
timed (values by period), asked (given at every run) or formula (computed from its formula at every run). New values may be added: treat a value you do not know as valid, not as an error.
Known values (open: expect new ones) timed, asked, formula
For timed variables, the values by period.
3 attributes of each item
Lines whose formulas or condition use this variable (it cannot be removed while non-empty).
True when the key can no longer change (used by a line, or a run recorded a value for it).
Required for kind=formula; null otherwise. Uses system values and variables earlier in the submitted variable list; self and forward references are refused. Evaluated after system values, before lines, using Decimal precision 28.
For an asked number only: how a billing run computes the value it takes from a purchase invoice's chosen lines, a formula in the invoice context (see parseBillingFormula), e.g. sum_lines(line.amount / line.quantity) for a price per unit.
Details
Null: the chosen lines' sum, sum_lines(line.amount). Stored normalised; the default written out is stored as null.
The plan this one was copied from (an independent plan, not a revision).
What still blocks approving a draft; empty when it can be approved (and on an approved plan).
4 attributes of each item
Machine code, e.g. name_missing, start_missing, end_before_start, no_lines, line_label_missing, line_price_missing, line_formula_missing, bill_to_missing, bill_to_invalid, variable_gap, variable_key_invalid, variable_key_duplicate, segment_overlap, segment_end_before_start, segment_value_invalid, condition_variable_unknown, condition_property_unknown, dimension_value_missing, dimension_not_allowed, dimension_duplicate, recipient_selection_empty, recipient_not_in_plan.
The plan's currency can no longer be changed: an invoice from the plan has been issued (a save that changes it is refused, BILLING_PLAN_CURRENCY_LOCKED). To bill in another currency, copy the plan.
Every revision, oldest first. Only with expand=revisions.
4 attributes of each item
Due on the last day of the invoice date's month, or the next month's last day when issued on month end. Counts from the invoice date on every run, regardless of the billed period. Cannot be combined with due_day_of_next_month; payment_term_days is ignored when true.
When the plan was approved (a general meeting or a signed contract). Runs issue only from an approved plan.
For an approved plan with issued invoices: the first period with no issued invoice, the earliest effective_from a change may take. Null when a change is made in place.
Parts of the plan left out because the token's scopes do not read them: contacts (the contacts a partners plan bills, recipient_partner_ids, and the contacts a line selects, by contacts:read), objects (the objects a line of an object-type plan selects, by objects:read). Empty for the web app.
Known values (open: expect new ones) contacts, objects