Billing meters represent usage metrics (e.g., API calls, storage use, transaction value) that your applications track and bill for. Each meter defines:
count, sum, latest, fixed-retainer,or max)aggregation_field) to apply that aggregation on;id is a unique code for a meter (merchant-defined or system generated)Below is the complete list of aggregation types officially supported by XStak.
| Aggregation Type | Description | Transcription |
|---|---|---|
| SUM | Sum of a defined property for incoming events | SUM(events.payload.value) |
| COUNT | Count the number of times an incoming event occurs | COUNT(events) |
| LATEST | Get the latest value from timestamp property for incoming events | LAST_VALUE(events) OVER ([PARTITION BY events.timestamp]) |
| MAX | Get the maximum value of a defined property for incoming events | MAX(events.payload.value) |
| FIXED-RETAINER | Charge customers a fixed base amount every billing period | N/A |
While COUNT tallies the number of times an event occurs, all other types aggregate over a single property of the event. The result of this aggregation directly determines how your customers are charged.
LATEST aggregation type is one-time only, meaning it cannot be recurring, and the number of billing units resets to 0 at the end of each period.
MAX aggregation type is one-time only, meaning it cannot be recurring, and the number of billing units resets to 0 at the end of each period.
How Fixed-Retainer Works