Your app asks one question: does this customer have it?
You named the access (pro) and pointed a product at it. Now the last piece: your app asks the question — "does this customer have pro?" — and shows or hides the feature accordingly. You never look at subscriptions, rails, or payment dates. You ask for the name, and Crossdeck answers true or false.
It's two moves: warm the answer once (a quick fetch), then check it instantly, as many times as you like, anywhere in your code.
Warm once, then check
Call getEntitlements() once — after you identify the user, or as the app loads. Then check isEntitled() wherever a feature should be gated.
// once — after identify(), or on app load
await Crossdeck.getEntitlements();
// then, anywhere, instantly:
if (Crossdeck.isEntitled("pro")) {
showProFeatures();
}
// once — after identify, or on app load
try? await cd?.getEntitlements()
// then, anywhere, instantly:
if cd?.isEntitled("pro") == true {
showProFeatures()
}
In React, skip the boilerplate — the hook re-renders your component the moment access changes:
import { useEntitlement } from "@cross-deck/web/react";
function ProPanel() {
const isPro = useEntitlement("pro"); // re-renders when access changes
return isPro ? <ProUI /> : <UpgradePrompt />;
}
Warm fetches; check reads the cache instantly
getEntitlements() asks the server for this customer's access and caches it on the device. isEntitled() reads that cache and answers immediately — it's a plain true/false, so never await it. Re-warm after a fresh login so a new person gets their own access, not the last user's.
Where you put the gate matters. A simple rule of thumb from the docs: if someone slipping past would cost you money or expose customer data, check it on your server too (your backend asks Crossdeck the same question). If it would just embarrass the UI — a button that shouldn't be there — the client check is plenty. Most apps do both: the client gate for a clean experience, the server gate as the real lock.
Paid unlocks, free stays locked
Sign in as a paying account and the feature appears; sign in as a free one and it doesn't. That single check is the whole gate. In the last lesson, you'll prove it both ways in under a minute.
The paid account sees the Pro feature; the free account gets the upgrade prompt — from one isEntitled("pro").