A meter counts something your customers use, such as API requests or messages sent. Your system reports each use as a usage event, and PaymentHooks adds the events up per customer for each billing period. Meters live under Catalog > Meters.
A meter on its own only records usage. It does something with that usage once something uses it:
- A metered price bills the meter's usage on each renewal invoice. Choose the meter when you create a price with the pricing model
Usage-based. - A metered feature counts the meter's usage against each plan's allowance, for example
5,000 API calls a month, and can restrict or bill usage above it.
The Used by column on Catalog > Meters shows how many prices and features use each meter. Open a meter to see them under Used by: each metered price with its product, and each metered feature, with links to them.
Create a meter
- 1Open Catalog > Meters and click Create meter.
- 2Enter a Display name, for example
API requests. - 3Enter an Event name, for example
api_request. Use letters, digits and_ . : -. Your system sends this name with every usage event. It must be unique and cannot be changed later. - 4Choose an Aggregation: how a period's events become one number.
- 5Leave Customer key (
customerId) and Value key (value) as they are unless your developer asks for other names. - 6Click Create meter.
| Aggregation | What is billed |
|---|---|
| Sum of values | The total of all values reported in the period. |
| Count of events | How many events were reported. |
| Maximum value | The largest single value reported. |
| Last value | The most recent value reported. |
Report usage
Usage is normally reported by your system through the meter events API. Each event carries the customer, a whole-number value and a unique identifier, so sending the same event twice never counts it twice. An event can be dated up to 35 days back, and its date decides which billing period it counts in.
To record usage by hand, open the meter, enter the Customer id and Value under Record usage, and click Record.
See usage
The meter page shows Usage by customer for the last 30 days and the Latest events. Click Deactivate to stop a meter; new events for an inactive meter are refused. Click Activate to turn it back on.