Skip to main content
This guide shows you how to check if a user has an active subscription and gate premium content accordingly. You’ll also learn how to handle user login/logout to sync subscriptions across devices.

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

Use hasAccess(to:) to check if the user has access to a specific product:
Or use isSubscribed to check if the user has any active subscription:

View active memberships

Access the memberships 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. Since Checkout 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
No manual refresh is needed.

Next steps

Build a Paywall

Display plans and handle purchases

API Reference

Explore all available methods and properties