Docs

Log into read the version of docs relevant to your site.

Setting up Usage Based Billing

Introduction

Usage-Based Billing (UBB) allows you to charge customers based on their actual consumption of your product or service. Setting up usage based billing in Chargebee is straightforward, enabling you to ingest and track usage, observe customer behavior, then define pricing, and generate invoices seamlessly. You can do this in the following key steps:

  1. Ingest your usage events into Chargebee
  2. Define metered features
  3. Link pricing for metered features

The test site is your sandbox environment to explore and validate the full flow of UBB. This guide will give you a quick summary of the steps to configure Usage Based Billing for your business. Visit the respective documents for detailed step-by-step configuration.

Prerequisites

Before setting up Usage Based Billing in your Chargebee Billing site for your business, ensure the following prerequisites are met:

  • Currencies and Billing Frequencies: Configure all supported currencies, and billing frequencies for your business.
  • Product Catalog: Setup your product catalog by creating relevant product families, plans, and addons[/billing/2.0/product-catalog/addons]. Specify usage based plans and addons as metered so that you can specify the usage based pricing under on-demand usage.

Ingest your Usage Events into Chargebee

Everything begins with usage data. These events capture how your customers consume your product — such as an API call, a gigabyte of storage used, a message sent, or a seat activated. You may not choose to monetize every event immediately. However, ingesting usage data enables you to analyze consumption patterns, identify trends, and make informed monetization decisions over time.

The first and often the most challenging step in usage tracking and billing is data ingestion. Chargebee ensures that data ingestion is no longer a roadblock but a streamlined starting point for your usage tracking/usage based billing journey. You can seamlessly ingest your usage data into Chargebee without the need to reformat or modify it to fit specific templates or schema. Chargebee's usage ingestion is schemaless, designed to work with raw data, capturing and processing it directly as you provide it. This minimizes the need for manual intervention and streamlines your workflow. Chargebee supports three simple methods for importing usage events:

  • Programmatically via API: Send usage events programmatically to Chargebee in real-time or in batches. This method is ideal for automated and large-scale data ingestion.
  • Bulk upload via CSV: Upload usage data in bulk using a supported file format like CSV. This is useful for processing historical data or large volumes of usage records.
  • Manual entry in the UI: Enter usage events manually through the Chargebee Billing User Interface(UI) for smaller datasets or one-off entries.

Each method ensures that your usage data is recorded accurately and ready for billing. Learn how to bring in your usage events into Chargebee Billing.

Define Metered Features

Once your raw (or relevant) usage data is flowing into Chargebee, the next step is to determine which aspects of that usage you want to track and potentially monetize. This is where metered features come in.

For example:

  • If you ingest API call events, you can define a metered feature such as “Number of API Calls.”

  • If you track storage consumption, you can create a metered feature like “Storage (GB).”

Metered features act as the bridge between raw usage data and monetization. They transform granular event data into measurable units that can be priced, billed, and reported on. Learn how you can define metered features in your Chargebee Billing site.

Once you’ve defined the usage you want to track (metered features), you can link pricing to each metered feature through plans and addons to determine how customers are charged based on their usage.

This is where you configure how a metered feature is associated with a plan or addon — including any included usage and how overages are charged. This mapping determines how customer consumption translates into billable amounts. By defining included quantities, pricing tiers, or overage rates, you establish the logic that governs how customers are charged based on their usage. Learn how you can link pricing for metered features in your Chargebee Billing site

Test Using Time Machine

This is an optional step. Once your usage ingestion, metered features, and pricing configuration are set up, the final step is to validate the billing flow. Waiting for your actual billing cycles can delay testing. You can use Chargebee Billing Time Machine, a testing utility that allows you to simulate billing period transitions in your test site.

Note:

Once you enter the Time Machine feature, the existing subscriptions and customer details will be erased, leaving you with an empty site. If you wish to take a backup of the data, we recommend you to export the data.

To test your usage based billing workflow using Time machine, follow these steps:

  1. Navigate to Settings > Configure Chargebee > Time Machine and enable Time Machine.
  2. Create a test customer and subscription.
  3. Ingest usage events for the subscription.
  4. Advance time using Time Machine to simulate billing cycle progression.
  5. Review the following:
    • Usage Summary on the subscription
    • Invoices generated
    • Applied charges and pricing calculations

This validation ensures that:

  • Usage events are successfully ingested.
  • Events are mapped correctly to metered features.
  • Included usage and overage pricing are applied accurately.
  • Charges are reflected correctly in invoices.

With this validation complete, you can confidently launch your usage-based pricing model on your Live site.

Usage Based Billing in Action

Once your setup is complete, Chargebee automates the usage based billing process. Usage attributes are tracked via metered features for relevant subscriptions/customers. At the end of each billing period, Chargebee computes the invoice amount based on the customer's usage of the metered feature and price defined in the respective plan/addon.

Navigate to the Usage Summary section in the Subscription/Customer details page to review the usages.

Chargebee Billing Invoice clearly displays a break up of all charges based on customer's usages against each metered item.

Was this article helpful?