What is Events-Based Billing?
Events-Based Billing is an evolved form of metered billing that is based on data-rich events streamed in real-time from your system to Chargify.
These events can then be transformed, enriched, or analyzed to form the computed totals of usage charges billed to your customers.
Events are actions occurring in your system that you wish to track. These actions might be triggers for the value you create for your customers. They are represented as JSON objects.
- The API calls made to your app
- The logins or pageviews of your users
- The shipping and return orders of your business
“Streams” are collections of similar events. You can think of a stream as a database table, where each entry in the table is an event. Events in a stream should have similar schemas, although that is not required. Each stream has its own API endpoint where you send events to Chargify in real-time as they happen in your system.
To learn more about how to architect your events and streams, check out our Event Data Modeling Guide.
The guide on Getting Data In explains how to create streams and work with the events API.
Metrics are used to measure the events in your streams and produce values for them.
Metrics can use one of the following types of analyses: count, sum, average, median, minimum, maximum, and percentile.
Some examples include:
- Count of a type of API request
- Average response time of API requests
- Sum of minutes spent on your app
Metrics are how insights are extracted from events in order to track data of interest over time. A single stream can have many metrics.`
The “Getting Data In” guide contains a section on Creating Metrics.
Billing on Events
Once you have streamed events and defined one or more metrics, you can bill for them! For this, you must create an event-based component, which was recently introduced into the standard Chargify component system.
Event-based components are similar to other component types, in that you define the component parameters (such as name and taxability) and the pricing. A key difference for the event-based component is that it must be attached to a metric. This is because the metric provides the component with the actual quantity used in computing what and how much will be billed each period for each subscription.
So, instead of reporting usage directly for each component (as you would with metered components), the usage is derived from analysis of your events.
The guide for Billing on Events details how to set up the components and configure your billing on events.
Analyzing Event Data
You are not required to bill for your events. You may choose to just send all of your events to Chargify for analysis and insights. You may even find that you want to change from billing on one event metric to another event metric entirely. When all of your event data lives in Chargify, changes like that become easy.
You can analyze your events using the graphs provided on the Metrics screen.
An Event is an action or occurrence that happens in your system that is represented as JSON data objects and reported to Chargify.
A Stream is a collection of similar events, usually with a similar schema.
A Metric is a computation (e.g. count, sum, or average) from a stream of events to produce a numeric value which measures event data you are interested in. Usually, metrics are plotted or observed over different time frames and intervals to extract insights.
A Data Store is a collection of event streams analagous to a database. Chargify gives you a data store automatically when Events-Based Billing is enabled, but you can attach other data stores from supported partners.