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.
|Industry||Billable Metric Examples|
|Financial APIs|| |
|Cloud & Data Infrastructure|
You can set two different tier modes for the billable metric.
|Graduated||graduated pricing charges for the usage in each tier instead of applying a single price to all usage|
|Volume||the subscription item is billed at the tier corresponding to the amount of usage at the end of the period|
|Sum||The 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_period||The 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_ever||The 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.|
|max||The 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:
|billable_metric_id||the ID of the billable metric. Auto generated from when you create a billable metric. See our reference guide for more details.|
|custom_uid||the ID of the customer using this. This will be your customer's uid.|
|amount||A double for how much of the billable metric is being consumed.|
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.
Updated about 2 months ago