Two decision types
- Feature gates — boolean access, such as analytics or SSO.
- Usage limits — numeric caps, such as monthly requests or generated reports.
Server-side enforcement
can() immediately before protected work. Deny only when allowed is false. overage: true never denies by itself: a soft limit is reached and the usage is billed as overage, so warn or notify instead of blocking. The response can include usage and margin context in addition to the allow/deny decision.
React presentation
Fetch entitlement state through your authenticated backend and pass it into presentational gates:Updates
Refresh entitlement state after checkout, subscription, or usage changes. For push-based updates, issue a separate server-authorized realtime token or publish through your own authenticated channel. Never sendpk_ or sk_ credentials to a browser WebSocket connection.
Margin-aware decisions
can() can return an economics estimate (cost, revenue and margin of the call) and a policy object with the decision of an optional margin policy. Use them for observability or merchant-defined policy without exposing them to customers unless required. Nozle sends no margin notifications; see Monitor margin yourself.