Charging up to a maximum
Declare the ceiling withmaxQuantity instead of quantity:
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.Go: Meter takes fixed quantities only
Go’sMeter 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.