Billable Metrics

The flexible unit of usage

Billable metrics are the unit by which you will charge your users. We allow you to create ANY metric from storage, compute, streamed minutes, etc and then bill on it for a subscription.

You can attach ANY number of billable metrics to a plan that is assigned to a user with custom pricing models.

Some examples that may come up based on the industry you're in.

IndustryBillable Metric Examples
Financial APIs options_trade_executed
managed_account
Cloud & Data Infrastructurebucket_storage
files_uploaded
errors_processed
Communicationsemails_sent
video_minutes_streamed
call_transcripts_generated
Integrationsconnected_accounts
transactions_synced
Analyticsmonthly_tracked_user
signups_attributed
process_timeouts

You can set two different tier modes for the billable metric.

Tiered ModeDescription
Graduatedgraduated pricing charges for the usage in each tier instead of applying a single price to all usage
Volumethe subscription item is billed at the tier corresponding to the amount of usage at the end of the period
Aggregation TypeDescription
SumThe default value (passed if you don’t specify the parameter). The total billed is based on the sum of all usage records for the billing period.
last_during_periodThe total billed is based on the most recent usage record for the billing period. If no usage is reported for the billing period, the total billed is based on a usage quantity of 0.
last_everThe total billed is based on the most recently provided usage record. If no usage is reported during the current billing period, Stripe looks for a previous usage record. If no usage record is found, the total billed is based on a usage quantity of 0.
maxThe total billed is based on the usage record with the largest usage quantity for the billing period. If no usage is reported for the billing period, the total billed is based on a usage quantity of 0.

Use the LogUsage function to send metric data.

You need to pass these three fields anytime:

FieldsDescription
billable_metric_idthe ID of the billable metric. Auto generated from when you create a billable metric. See our reference guide for more details.
custom_uidthe ID of the customer using this. This will be your customer's uid.
amountA double for how much of the billable metric is being consumed.

📘

Amount Decrements

You can optionally decrement a billable metric as well.

When you pass the billable metric track function, you can generally opt to check for a return to make sure that a threshold/limit hasn't been exceeded to block overages. More details can be found in the REST Docs.


What’s Next

Now that you understand how billable metrics work and what they are, the next step is to understand customers and products!