How it works
- The Product’s billable metric must use Sum (
sum_agg). It measures the quantity, for example the units in each event. - Each event sends its own total in
precise_total_amount_cents: a finite amount in cents, as a number or decimal string. - The fee is the sum of those event amounts for the period.
properties and the event’s total monetary amount in precise_total_amount_cents. Lago aggregates the quantity and sums the monetary amounts separately.
Availability
- Fixed Products: not available.
- Metered Products: Sum metrics only, with
recurring: falseorrecurring: truewithout proration. Arrears and advance.
Configure the rate
Setrate_model to dynamic. The model needs no rate_properties.
Example
This example uses a metered Product,sms_messages, and sms_units, a Sum metric on the units property. Two events fall within the same full monthly billing period. The Rate Card uses USD, with no proration or spending minimum:
The measured quantity is 12 units. The calculated fee is 1.25 USD before tax: 70 + 55 = 125 cents.
Send
precise_total_amount_cents on every event priced this way.
Check the result
Compare the sum of event quantities with the measured quantity, and the sum of event amounts with the calculated fee. Check these two totals separately. Use Contract current usage to inspect provisional values. See Rates to check which Rate applies.Usage ingestion
Send events to a Contract.
Pricing models
Compare every rate model.
Ingest a batch of events
POST /events/batchCreate a rate
POST /rate_cards/{rate_card_code}/rates