React Hooks

Lumn provides a set of hooks to selectively access billing and entitlement data anywhere in your application.

Interactive UI & Output

Please enter your API Key in the top right to enable live interactive demos.

Available Hooks

useEntitlements()

The primary hook for feature gating. Use it to check if a customer has access to specific features and view their remaining usage quotas.

Initialization

const { checkEntitlement, getUsageBalance } = useEntitlements();

Methods & Properties

checkEntitlement()

Promise<EntitlementCheck>

Verify if a customer is entitled to a specific feature key. Returns details about their access status and why (e.g. missing subscription, active trial).

ArgumentTypeRequiredDescription
featureKeystringREQUIREDThe unique key of the feature to check.
customerIdstringOPTIONALThe customer identifier in your system.

getUsageBalance()

Promise<UsageBalance>

Retrieve detailed usage quotas for metered features. Returns the total limit, current usage, remaining balance, and when the quota resets.

ArgumentTypeRequiredDescription
featureKeystringREQUIREDThe unique key of the metered feature.
customerIdstringOPTIONALThe customer identifier in your system.

Interactive Playground

API Key required to run playground