Meter Attributes
Meter attributes let you track and enforce usage limits on a license, which is useful when you want your customers to pay for what they actively use regardless of how long they possess your product. Usage can be defined as the number of specific operations performed in your app, the number of times it is run, or the number of times a feature is used.
Meter attribute properties
A meter attribute added to a license has the following properties:
| Property | Description |
|---|---|
| Name | Name of the meter attribute. |
| Allowed Uses | The maximum allowed uses for the attribute. Set to -1 to allow unlimited uses. |
| Total Uses | The current uses for the attribute. Its value can be incremented, decremented, or reset in your app using LexActivator functions. |
| Gross Uses | Tracks the lifetime usage of the meter attribute. |
| Floating | If set to true, the uses consumed by an activation are automatically reset when the activation is deleted. |
| View Permissions | Controls who can see the attribute. See below. |
View Permissions
Admins control the visibility of meter attributes by granting one or more of the following permissions:
| Permission | Visible to | Web API |
|---|---|---|
| Activation | Your app, through the LexActivator SDK | POST /v3/activations |
| User | End users in the customer portal | GET /v3/me/licenses |
| Organization | Organization admins in the customer portal | GET /v3/organizations/:id/licenses |
| Reseller | Reseller admins in the reseller portal | GET /v3/resellers/:id/licenses |
Enforcing meter attributes schema
To make some meter attributes required for your licenses, add them to the requiredMeterAttributes property of the license template. This also automatically creates the meter attributes in the license form.
Using meter attributes
For the end-to-end flow and pricing patterns, see Usage-Based Licensing. This section covers the mechanics.
The functions your app uses to report usage depend on the license type.
Node-locked and hosted floating licenses
Report usage through these LexActivator functions:
GetActivationMeterAttributeUses(), IncrementActivationMeterAttributeUses(), DecrementActivationMeterAttributeUses(), ResetActivationMeterAttributeUses()
Each increment, decrement, or reset is a real-time network call to the Cryptlex server, so the count is always current. To meter while offline, buffer the counts locally in your app and apply them in bulk with a single increment once the connection is restored.
On-premise floating licenses
Report usage through the corresponding LexFloatClient functions:
GetFloatingClientMeterAttributeUses(), IncrementFloatingClientMeterAttributeUses(), DecrementFloatingClientMeterAttributeUses(), ResetFloatingClientMeterAttributeUses()
These calls go to your LexFloatServer, which tracks usage locally, making metering possible in offline and air-gapped environments.
Usage limits
For all license types, usage aggregates across every activation into one shared pool, and the license stays genuine even at the limit. When the count reaches the allowedUses limit, further increments fail with a limit-reached error: LA_E_METER_ATTRIBUTE_USES_LIMIT_REACHED from LexActivator, or LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED from LexFloatClient.