Working with Consumption-Based Licenses: Tutorial and Best Practices

Published on: August 18, 2022
Last updated: July 6, 2023
LicenseSpring Guide
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.

We made a video introducing the concept of consumption-based licensing, please enjoy.

Sections:

  • 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.

cpp
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.

cpp
1 void syncConsumption( int32_t requestOverage = -1 )

Kyle Brandon
Kyle BrandonSystems Engineer - LicenseSpring Software
Kyle Brandon is a Systems Engineer at LicenseSpring Software, based out of Vancouver, Canada. With over two years experience, Kyle helps current and prospective customers with ensuring successful implementation of all LicenseSpring has to offer. Specializing in Computing Science, Kyle uses that experience to assist with troubleshooting user-reported bugs and provide helpful guides.
0.O