Skip to main content
You can’t price some work until it is done: tokens generated, pages extracted, seconds of processing. Charging a flat worst-case rate overcharges everyone else; metering after the fact leaves the buyer unauthorized. ZeroClick’s answer is a ceiling: declare the most the request could use, let the buyer authorize that maximum, and settle at what the request actually used.

Charging up to a maximum

Declare the ceiling with maxQuantity instead of quantity:
The buyer authorizes up to the ceiling, and the payment settles at the actual usage you report: a ceiling never overcharges. The SDK rejects a usage item that declares both quantity and maxQuantity before any network call. You can also declare neither: the item then defers to the meter’s configured Max usage per request (defaultMaxQuantity on the plan’s meter price). That keeps the ceiling in your catalog instead of your code. If the meter has no configured maximum, the allowance check denies with meter_not_priced. On the buyer’s side, a ceiling is payable only on the reserve payment rails: the agent authorizes the maximum and pays the actual amount you settle. An exact quantity lets ZeroClick offer the immediate-settle scheme more clients can pay today, so when you know the size, prefer fixed charges. See payment protocols.

Settle at the actual amount

A ceiling has no settled quantity until you report one. Settle it like any other usage: on the response for amounts you know by the end of the handler, or asynchronously for work that finishes later.
The settled quantity can be anywhere from zero up to the declared ceiling. An unreported ceiling on a paid, delivered response settles at zero (safe for the buyer, unbilled for you), so the report is what turns the work into revenue. See settle usage for the header rules (2xx only, stripped by ZeroClick).

Go: Meter takes fixed quantities only

Go’s Meter middleware settles exactly what it declares, so it accepts fixed quantities only. Handed an UpTo item, it panics at wire-up: a ceiling has no settled quantity, and the middleware would otherwise bill zero, silently, on a delivered 200. You have two working shapes: call Guard yourself and settle explicitly, or keep Meter for a fixed per-request charge and report the variable part after responding.
The fixed charge keeps the immediate-settle scheme available to buyers; the report settles the variable part. The same fixed-plus-reported split works in any language when you know the variable amount only after the response. See settle usage for the reporting rules.