Usage of one meter against the customer's limit
Answered from near-real-time counters. They are eventually consistent (typically well under 2 s behind ingest): `as_of` is the ingest time of the newest event reflected in `used`. Payrudder never blocks ingest on a limit; call this before serving your customer and decide what to do. A customer without an entitlement on the meter is `unlimited`. `period` defaults to the current period in the tenant's time zone. A limit counts over its `window`: the billing month, or an hour, a day, an ISO week, a calendar year or the customer's whole lifetime, in the tenant's time zone. `period` picks the month of a monthly limit; every other window always reports its current one (`window_id`, ending at `resets_at`, which a lifetime window does not have). `allowed` follows the limit's `mode`: a `hard` limit stops allowing at the limit, a `soft` or `notify` one keeps allowing and says `over_limit`. Every window's counter is reconciled against the aggregator every few minutes, so an event delivered twice stops counting twice within one cycle.
Loading the operation...
On-time usage of a customer in a period, per meter GET
Quantities are exact decimals with the meter's scale. Usage that arrived after the period's cutoff is not included here: it is billed on a later invoice as late usage. `period` defaults to the current period in the tenant's time zone.
What the customer's next invoice would be if it were drafted now GET
An estimate of the regular invoice of the period that is still open (or, while a closed period's grace period runs, of that period): the usage and late usage so far, rated by the plan version in force, the fixed fee, tax at the tenant's rate for the customer's country and the credit balance the invoice would use. It is computed by the same code that drafts the real invoice, from the same inputs, and nothing is stored. It moves with every event until the period closes, and a change of plan, a coupon or a tax rate made later can move it too: `estimate` is always `true`, and the response has no id and no number. A fixed fee invoiced in advance is its own invoice and is not in it. A customer with nothing to bill in the period gets `has_invoice: false` and no lines.