What you’ll learn
- Check if a user has access to a product
- Gate content based on subscription status
- Sync subscriptions across devices with user login
Prerequisites
Check subscription status
UsehasAccess(to:) to check if the user has access to a specific product:
isSubscribed to check if the user has any active subscription:
View active memberships
Access thememberships array to show subscription details:
User login and logout
User IDs allow subscriptions to sync across devices. When a user logs in, the SDK automatically claims any unclaimed memberships from the current device and loads their existing memberships.Log in a user
Log out a user
Check the current user
Guest purchases
Users can purchase subscriptions even without logging in. The SDK tracks these purchases by device ID and automatically claims them when the user logs in.Complete example
Here’s a complete example showing entitlement checking with user auth:Reactive updates
The SDK automatically updates views when subscription status changes. SinceCheckout is @Observable, any view using @Environment(Checkout.self) will re-render when:
- A purchase completes
- A user logs in or out
- Memberships are loaded or updated

