Product access
For subscriptions and one-time purchases alike, the productAccess array on the user object is the source of truth for what a user can use right now. Your application gates features and content by checking whether a product ID appears in that array.
What it contains
productAccess is an array of product IDs — strings like p-live-pro for live products or p-test-abc123 for sandbox products. IDs always belong to the environment your SDK is using; live and sandbox catalogs are independent. Each ID corresponds to a product the user currently has access to — an active subscription, or a one-time purchase they've completed. The array can hold zero, one, or many IDs depending on what the user has purchased.
The full user object that contains this array is documented in User object.
When it's populated and updated
After successful checkout
The purchased product ID is added to productAccess. userChange fires with event: 'checkout'.
On session restore
tiun rebuilds productAccess for the returning user. userChange fires with event: 'init'.
After login
productAccess reflects whatever the user is entitled to. userChange fires with event: 'login'.
When a subscription expires or is cancelled
The product ID is removed from productAccess and userChange fires. The customer should lose access at that moment.
For a one-time purchase
The product ID is added at checkout and never removed — one-time purchases don't renew and don't expire.
After logout
The user object becomes null; there is no productAccess to check.
You don't manage renewals yourself — for subscriptions, tiun handles billing cycles and keeps productAccess consistent with what the customer has paid for. See Subscriptions and One-time purchases for the full lifecycle of each.
Checking access
Read productAccess from the userChange payload (preferred) or via tiun.user:
Replace the example IDs with the product IDs from your my.tiun.business dashboard. For the broader UI gating pattern that combines this with isAuthenticated, see Protecting content.
Your backend can also read productAccess for any user by their userId — without the user being present — via the UserInfo API. See getting user info server-side.
Last updated
Was this helpful?

