Working with Consumption-Based Licenses

Published on: August 18, 2022
Table of Contents:

Consumption-based licensing allows the software vendor to meter the usage of a given resource within their application. A resource can be the number of reports generated, API requests made, minutes of a service used, or the number of times an application is executed, for example. LicenseSpring supports the configuration of overages, as well as periodic allowance reset.

For this tutorial, we will be creating a chatbot that can increment, decrement and track consumptions. This guide will mention and provide code snippets from the code, as well as link the source code for the chatbot.

For a video introducing the concept of consumption-based licensing see here.


  • Activation Versus Consumption
  • Difference Between Consumption Licensing and Feature Consumption
  • Controlling the State of the Application with Total Consumptions and Max Consumptions, Overages, and Periodic Allowances
  • Considerations with Multiple Activations and Offline Usage

Activation Versus Consumption:

Activating doesn’t count as a consumption/using the license. If a user activates their license, they’ll still have 0 total consumptions. It is up to the developer to figure out what counts as a consumption and update accordingly using updateConsumption and syncConsumption. To be able to use consumptions on their license, a user must first activate their license.

Difference Between Consumption Licensing and Feature Consumption:

Unlike a consumption-based license, feature-based consumption allows additional flexibility for the software vendor, as they can then meter multiple components or modules of the same application differently. Features can also be set to expire, after which they are removed from the entitlement altogether.

Controlling the State of the Application with Total Consumptions and Max Consumptions, Overages, and Period Allowances:

The following function, updateConsumptions(), increases or decreases license consumptions by the value given in the first parameter. saveLicense is a boolean that controls whether the license should be saved to file or not.

1 void updateConsumption( int32_t value = 1, bool saveLicense = true )

This next function syncs the consumption license values with the server, so that the server is providing accurate consumption-based data. The parameter requestOverage allows users to request consumption overages.

1 void syncConsumption( int32_t requestOverage = -1 )