SDKs
...
Licensing Scenarios
License Type Options
Consumption-Based
12min
consumption licenses are ideal for applications where usage is metered based on a chosen metric, for example the number of api calls, data transfer volume, or any other measurable unit these licenses allow developers to set usage limits and track consumption, ensuring fair and flexible licensing for their users prerequisites completed the getting started docid\ lsfy9tq3vfq4roow9shkd tutorial, including initialized licensemanager (or licensehandler ) with your configuration using the appropriate settings created a licenseid using either licenseid fromkey or licenseid fromuser function, depending on the activation method you prefer activated a license of any type implementing a consumption license configuring a consumption license when granting a license, choose the "consumption" type as the preferred option the key parameters associated with this type are as follows max consumption this parameter specifies the upper limit for the license usage, defining the maximum number of permitted uses allow overages by using this parameter, the software vendor can determine whether to block any additional usage beyond the maximum consumption limit this can be further configured to allow a limited number of over usages or to have no restrictions (unlimited) on overages reset consumption this parameter facilitates periodic resetting of the available usage count back to the value provided in the "max consumption" field the reset period can be set to daily, weekly, monthly, or annually, as per the vendor's requirements obtaining maximum and total consumption maxconsumption() defines the upper limit or cap on the license usage, indicating the maximum number of allowed usages for the licensed product or service this parameter ensures that users do not exceed a predetermined threshold, enabling software vendors to control and manage the license's usage scope this method is shown below int32 t licensespring license maxconsumption() license maxcomsumptionsint license maxconsumption();license max consumptions() on the other hand, totalconsumption() refers to the actual number of times the license has been utilized by the end users monitoring the total consumption is crucial for both software vendors and users, as it provides insights into the software's popularity and usage patterns int32 t licensespring license totalconsumption()license consumptionsint license totalconsumption();license total consumptions() adding and synchronizing consumption the function named updateconsumption() , shown below, serves to modify the license consumptions based on the value specified in the first parameter void licensespring license updateconsumption( int32 t value = 1, bool savelicense = true ) try license updateconsumptions(difference 3)void license updateconsumption(int value = 1);license add local consumption(3) by default, the value is set to 1, but it can be increased or decreased as needed additionally, the function allows users to control whether the updated license information should be saved to a file or not, depending on the savelicense boolean parameter if savelicense is set to true, the changes will be saved to a file, ensuring persistent license data notenoughconsumptionexception the consumption license or feature has depleted its available resources seen below, the syncconsumption() function is responsible for synchronizing the consumption license values with the server void licensespring license syncconsumption( int32 t requestoverage = 1 )	 try license syncconsumptions()bool license syncconsumption(overagerequest overagerequest = null);license sync consumption() this synchronization guarantees that the server is up to date with the latest accurate consumption based data the function accepts an optional parameter, requestoverage , which allows users to request consumption overages if necessary if no specific overage value is provided, the function will not request any particular overage amount from the server during synchronization unlimited consumption in an unlimited consumption model, users are granted access to the software with unrestricted usage rights there are no predefined limits or quotas on the number of times the software can be used or the features that can be accessed users can utilize the software freely and continuously, without any concerns about overages or exceeding usage limits whether this is enabled can be checked within the sdk by using the following boolean method bool licensespring license isunlimitedconsumptionallowed()license allowunlimitedconsumptionsbool license isunlimitedconsumptionallowed();license allow unlimited consumptions() consumption overages in a consumption license, an overage refers to the additional usage beyond the predefined limits or allocated resources set in the license agreement max overages refers to the maximum allowable number of additional usages beyond the defined consumption limit in a given period max overages can be accessed by using int32 t licensespring license maxoverages()license maxconsumptionoverageint license maxconsumptionoverage();license max overages() note in the case of unlimited overages, maxoverages() returns the maximum possible value in addition, developers have the option to verify whether overages are permitted by utilizing bool licensespring license isoveragesallowed()license isconsumptionoverageallowedbool license isconsumptionoverageallowed();license allow overages() consumption reset and period management consumption licenses can be reset on regular intervals, whether it be daily, weekly, monthly, or annually, as per the vendor's requirements this consumption reset sets the totalconsumption() to equal 0, as to reset the total consumptions the period of time after which the consumption is reset can be accessed, in the form of a consumptionperiod object using the following method consumptionperiod licensespring license consumptionperiod() license consumptionperiodconsumptionperiod license consumptionperiod();license consumption period() developers can also check for whether this periodic reset is enabled, by using the isresetconsumptionenabled() method on a license object bool licensespring license isresetconsumptionenabled()license isresetconsumptionenabledbool license isconsumptionresetenabled();license consumption reset()