Entitlements
Check if a user has access to a feature — `has()` for one, `list()` for all. Safe for paywall gating.
Entitlements are named permissions a user holds — typically tied to a subscription or one-time purchase. The SDK exposes two operations: has(name) to gate a specific feature, and list() to enumerate everything the user has.
Entitlement state is sourced from your billing system (RevenueCat, Stripe, App Store, Play Store) via webhooks; the SDK reads the resolved state for the signed-in user.
Quick start
Operations
has(name) — single check
Returns true if the user has the named entitlement and it's currently active. Defaults to false during loading or on error — safe for paywall gating (no flash-of-pro-content).
list() — all entitlements
Returns every entitlement the user holds, with the purchase that backs it (store, product, period, dates) and its active status. Each entitlement mirrors GET /v1/client/entitlements field-for-field:
| Field | Type | Notes |
|---|---|---|
entitlement_id | string | Project-defined entitlement key (e.g. "pro") — what has() checks. |
is_active | boolean | Whether it's currently active. |
product_id | string | null | Store product / SKU the grant resolved from, if any. |
store | "app_store" | "play_store" | "web" | null | Source store, or null for a grant not tied to a store purchase. |
purchase_date | string | null | ISO-8601 purchase time, or null. |
expiration_date | string | null | ISO-8601 expiry, or null for lifetime. |
period_type | "trial" | "intro" | "normal" | null | Subscription period phase, or null. |
React hook
The hook defaults to false while the initial fetch is in flight. Safe to use in render without an explicit loading guard for paywall logic.
restore() — Restore Purchases
Re-syncs the user's owned entitlements from the configured subscription service and returns the active set. App Store review (3.1.1) requires a visible Restore Purchases action for any app selling subscriptions — wire this to a button.
restore() is fail-closed: a transport failure rejects and leaves access exactly as it was (no silent unlock or revoke). A user with no prior purchases succeeds with restored_count: 0.
offerings() — the paywall read
Returns the offerings your paywall renders, each with its packages and the product behind each (display fields, trial info, per-store identifiers). Provider-neutral.
Declare products and offerings with the amba_products_create / amba_offerings_create MCP tools (or the /admin/projects/:projectId/subscriptions/* API). Render the packages, let the user purchase through the platform store, then gate features with has().
Patterns
Paywall gating
Hybrid client + server check
For revenue-critical actions, double-check on the server. Client-side checks are great UX (instant gating) but the server is source-of-truth:
Multi-tier products
Many apps ship pro / team / enterprise tiers. Model each as its own entitlement and check the highest-applicable:
Limits
- Entitlement names: lowercase, alphanumeric + underscore + dash, up to 64 characters.
- Refresh cadence: the SDK caches results for ~60 seconds per user; subsequent
has()calls within that window are served from cache. Force-refresh vialist()(which always hits the server). - Source-of-truth: entitlement state is set by your billing webhooks. The SDK reads it; it cannot grant or revoke.
- Paywall safety:
has()returnsfalseon network failure or unknown entitlement name. Plan UI to fail-closed.
Reference
- Client API — entitlements — endpoint reference.
- Webhooks: RevenueCat / Stripe — how entitlement state gets in.
- Auth feature — prerequisite.
- Per-platform quickstarts: Web, Node, iOS, Android, Flutter, Unity.