Track usage
Track usage for credits, limits, and usage-based entitlements.
Use usage tracking when a customer performs an action that should consume part of an entitlement.
This is useful for credits, exports, AI generations, downloads, API calls, or any feature with a limited amount of usage.
When to track usage
Track usage when the customer performs an action that should reduce a remaining value.
generating an AI result
exporting a file
using one credit
creating a project
downloading a resource
consuming an API call
Track usage
Call track with the entitlement ID or usage key and the amount you want to consume.
Examplefinal result = await Revenipe.instance.track(
id: 'monthly_credits',
value: 1,
);If the usage was successfully tracked, Revenipe returns the updated usage state.
Handle the result
Use the tracking result to decide whether the customer can continue using the feature.
Examplefinal result = await Revenipe.instance.track(
id: 'monthly_credits',
value: 1,
);
if (result.success) {
// Allow the action.
// Update your UI with the remaining value.
} else {
// Block the action or show an upgrade prompt.
}Entitlement ID vs usage key
The id can be either a direct entitlement ID or a usage key.
Usage keys are useful when a customer can receive usage from multiple sources.
Usage key example
For example, your app can use a shared usage key like credits.
Examplefinal result = await Revenipe.instance.track(
id: 'credits',
value: 1,
);Revenipe can then resolve the usage key against the customer's available entitlement sources.
Show remaining usage
Use getEntitlement when you want to show the current value or remaining usage in your UI.
Examplefinal entitlement = Revenipe.instance.getEntitlement('monthly_credits');This is useful for showing credit balances, remaining exports, or other usage-based values.
Important
Only track usage after the customer is logged in.
Do not reduce usage locally unless Revenipe confirms that the usage was successfully tracked.
If usage tracking fails, block the action, show an upgrade prompt, or retry depending on your app experience.
Use usage keys when multiple products, add-ons, or grants should contribute to one shared usage balance.
Next steps
After tracking usage, continue with products, entitlements, usage keys, and purchase flows to understand how usage is granted and consumed.