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:

PropertyDescription
NameName of the meter attribute.
Allowed UsesThe maximum allowed uses for the attribute. Set to -1 to allow unlimited uses.
Total UsesThe current uses for the attribute. Its value can be incremented, decremented, or reset in your app using LexActivator functions.
Gross UsesTracks the lifetime usage of the meter attribute.
FloatingIf set to true, the uses consumed by an activation are automatically reset when the activation is deleted.
View PermissionsControls 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:

PermissionVisible toWeb API
ActivationYour app, through the LexActivator SDKPOST /v3/activations
UserEnd users in the customer portalGET /v3/me/licenses
OrganizationOrganization admins in the customer portalGET /v3/organizations/:id/licenses
ResellerReseller admins in the reseller portalGET /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.

MetadataSuspending and Revoking Licenses
Last updated: