Meters
The billing.meter object
A meter counts, sums or keeps the latest value of the usage events you send for one event_name, so a usage-based price can bill each customer for what they used. It has the same shape as Stripe's billing meter.
Attributes
idstringRequiredUnique identifier for the object.
objectstringRequiredString naming the object's type.
livemodebooleanRequiredtruewhen the object exists in live mode,falsein test mode.createdtimestampRequiredTime the object was created, in Unix seconds.
updatedtimestampRequiredTime the object last changed, in Unix seconds.
customer_mappingobjectRequiredHow the meter finds the customer of each event: the
payloadkey that holds the customer's ID.Show child attributes
customer_mapping.event_payload_keystringRequiredThe
payloadkey whose value is the customer's ID;customer_idunless the meter set another.customer_mapping.typestringRequiredHow the key maps to a customer; always
by_id.by_idThe key holds the customer's ID.
default_aggregationobjectRequiredHow the meter combines the events it records.
Show child attributes
default_aggregation.formulastringRequiredThe formula the meter aggregates its events with.
sumAdds up the numeric value in each event's
payload.countCounts the events.
lastTakes the value of the latest event in the window.
display_namestringRequiredHuman-readable name of the meter.
event_namestringRequiredName of the usage events this meter records, unique among your meters. Send it as
event_nameonPOST /meter_events.event_time_windowenumRequiredNullableTime window the meter's events are pre-aggregated over, set only on a
summeter. Each event then carries the total for its UTC hour or day: only the latest event per customer and window counts, and the meter sums those values, the same way in event summaries, upcoming invoices and at the billing provider. Null when not set.dayEvents are pre-aggregated per day.
hourEvents are pre-aggregated per hour.
null
statusenumRequiredWhether the meter is active.
activeThe meter is in use.
inactiveThe meter was deactivated with
POST /meters/{id}/deactivate;status_transitions.deactivated_atsays when.
status_transitionsobjectRequiredWhen the meter's status last changed.
Show child attributes
status_transitions.deactivated_attimestampRequiredNullableUnix timestamp in seconds.
value_settingsobjectRequiredNullableWhere the meter reads each event's value: the
payloadkey that holds the number. Null for acountmeter, which reads no value.Show child attributes
value_settings.event_payload_keystringRequiredThe
payloadkey whose value is the event's number;valueunless the meter set another.
metadataobjectRequiredKey-value pairs you attach to the object for your own use. Paycose never reads or changes them.