Back to Blog Posts

Usage Billing: In Depth

By Matt / December 16th, 2019

In last weeks blog post, I provided an introduction to the Usage Billing functionality coming up in WHMCS 7.9.

In this post, we take a deeper dive into the mechanics of Usage Billing, how it works and how to get started with it.

An Intro to Metrics
Metrics are a fundamental concept and key part of the Usage Billing functionality in WHMCS 7.9.

A Metric is a measurement of usage within a given product or service for which pricing can be defined. The metrics for a product are defined by the provisioning module to which it is associated, and there can be many Metrics for a single product.

Disk Space, Bandwidth, MySQL Databases, Email Accounts and Subdomains are all examples of Metrics that are made available for hosting accounts under the cPanel and DirectAdmin modules.

The measurements of Metrics are referred to as Usage Data, which is collected and refreshed every 12 hours, and the provisioning module to which a product is associated controls and defines how data for a metric is measured and collected.

Enabling Metrics for Billing
Metrics can be viewed and managed in the Module Settings tab of Product Setup. If the selected module supports metrics, the Metric Billing section will be populated with each metric the module can observe.

At the time of writing, both the cPanel and DirectAdmin provisioning modules have support for Metric Billing.
The above screenshot shows the Module Settings tab for a cPanel hosting product. To enable a Metric for billing, simply slide the toggle On/Off toggle to On.

Setting Pricing
To configure pricing for a Metric, click the Configure Pricing link under the Metric name within the Module Settings tab of Product Setup.

Before you can set your pricing, it is important to understand the way in which a Metric is measured, and this is defined by two things: the Metric Type and the Metric Unit. These are displayed at the top of the Configure Pricing modal.
The Metric Type defines how the usage is reported. There are two types:
    * Snapshot - where the usage can be measured and billed for at any given point in time, but for which usage never resets. Examples of this are Disk Space, Number of Email Accounts and Number of Subdomains.
    * Time Based - where the usage is measured over a given period of time (typically Monthly) and resets to 0 at the end of the billing period. Bandwidth (pictured above) is an example of a measurement that is typically measured by month, and resets to zero at the end of each month.
In addition, the Metric Unit defines the unit of measurement used for the reported numbers. For example, with Disk Space and Bandwidth, this will most commonly be Gigabytes.

Choosing a Pricing Scheme
We've worked hard to provide a high level of flexibility and granularity to the way Metrics are priced and billed. There are 3 pricing schemes for you to choose from:

Per Unit
This is the simplest pricing scheme.

In a per-unit pricing scheme, all units cost the same. Simply enter a price per unit and you're done.

For example if you used Per Unit pricing for "Addon Domains" and defined a cost of $1/each/period and a customer buys 3, then a $3 charge would be added at the end of the period.

Total Volume
In the total volume pricing scheme, multiple price brackets define the prices at different quantity levels. The price per unit for all units is determined by the prevailing price for the total used quantity. An example can illustrate this the best. Say you allow your customers to use an unlimited number of MySQL Databases with a pricing structure defined as follows:

0-9 Databases: $2.00 per Database
10-19 Databases: $1.00 per Database
20+ Databases: $0.50 per Database

Using Total Volume Pricing, if a customer uses 8 MySQL Databases, they will pay $2 per database, for a total of $16.
If a customer uses 25 MySQL Databases, they will pay $0.50 per database, for a total of $12.50.

In this final pricing scheme, multiple price brackets define the prices at different quantity levels, much like in the Total Volume scheme. However, unlike the total volume scheme, your customers will pay the defined price per unit for each allocated unit. Let's see how this changes the price a customer pays using the same pricing as defined above for Total Volume.

Under Graduated Pricing, if a customer uses 8 MySQL Databases, they will pay $2 per database, for a total of $16.
Similarly, if a customer uses 25 MySQL Databases, they will pay $2 per database for the first 9 databases, plus $1 per database for the next 10 databases, plus $0.50 per database for the final 6 databases, for a total of $31 (9 x $2 + 10 x $1 + 6 x $0.50).

Viewing Metric Usage
The latest measurements for a Metric are displayed within the admin area when viewing a product/service. Metrics and their values will be displayed here regardless of if the Metric is enabled for billing.
The Enabled column provides an indication of whether the metric is enabled for billing at the product configuration level. A check indicates that the metric usage will be billed for periodically.

You can also manually poll for the latest values at any time by clicking the "Refresh Now" button located in the bottom right of the Metric Statistics panel.

Client side, end users will only see Metrics and measurements for which billing is enabled.

For example in a typical hosting product which has metrics for Disk Space, Bandwidth and MySQL Databases, if only the Bandwidth Metric is enabled for billing, only the Bandwidth Metric and its measurements will be displayed.
The screenshot above shows how this information appears for a product assigned to the cPanel module.

This allows admins and clients alike to track and see Usage throughout a billing cycle and gain insights into how products are being used, regardless of if Metric Billing is being employed.

Invoicing & Billing
Unlike most other billing in WHMCS, invoicing for Metrics is done post delivery and use of the service. That is to say that charges for Metric usage in the previous billing cycle period will be included in the renewal invoice for the next billing period.

For Snapshot Metrics, this means that the charge will be calculated using the latest measurement recorded at the time of the renewal invoice being generated.

For Time-Based Metrics, any time periods which have been fully completed will be included on renewal invoices. For example, when a product has Bandwidth Metric billing enabled, the renewal invoice will include charges for the previous complete month. It will not include charges for the current month.

On the invoice itself, each Metric that is enabled for billing will generate a line item that reports the total usage value and a breakdown of how the billed amount has been calculated.

The exact line item's description will vary based on the pricing scheme type, the pricing brackets, and the usage incurred, but all of it is customisable and translatable via the language files to ensure the best possible end user experience.
The Metric Billing functionality in WHMCS 7.9 opens up many more possibilities for how you price and bill for your services, and with a range of Pricing Schemes to choose from, provides flexibility to suit a wide range of business models.

With support for cPanel and DirectAdmin at the time of launch, and support for Plesk coming soon, as well as documentation already being available for 3rd party module developers, the Usage Billing functionality in WHMCS 7.9 is powerful, complete and ready for you to try today.

Get access to this and all the other new features in WHMCS 7.9 by joining the beta today. To learn more about WHMCS 7.9 and what else is new, as well as to find out how to get early access to our beta releases, visit

Thanks for reading!

Liked this article? Share it