The iOS WhopIAP SDK is coming soon. This documentation is a preview.
Checking Membership Status
Check Any Subscription
UseisSubscribed() to check if the user has access to any of your configured products:
Method Reference: isSubscribed()
Method Reference: isSubscribed()
true if the user has at least one active membership to any product in productIds.Note: Only checks products passed to configure(productIds:).Check Specific Product
UsehasAccess(to:) when you have multiple products with different access levels:
Method Reference: hasAccess(to:)
Method Reference: hasAccess(to:)
productId: The product ID to check (starts withprod_)
true if the user has an active membership for that specific product.Accessing Memberships Directly
For more granular control, access thememberships array:
Property Reference: Membership
Property Reference: Membership
| Property | Type | Description |
|---|---|---|
id | String | Membership ID |
productId | String | Associated product ID |
status | MembershipStatus | .active, .cancelled, .expired |
expiresAt | Date? | When the membership expires |
createdAt | Date | When the membership was created |
User Login
When a user logs in to your app, calllogIn() to associate their account with any device-level purchases:
What Happens on Login
1
Device memberships are claimed
Any purchases made before login are associated with the user’s account.
2
User memberships are loaded
Existing memberships from other devices are synced to this device.
3
Views update automatically
Since WhopIAP is
@Observable, any views using isSubscribed() or memberships refresh automatically.Method Reference: logIn()
Method Reference: logIn()
appUserId: Your app’s unique identifier for this user. Should not change for the same user.
WhopIAPError.tokenUnavailable if token fetch fails.Note: User IDs should be stable. Don’t use session tokens or values that change on each login.User Logout
When users log out, calllogOut() to clear user-specific data:
Method Reference: logOut()
Method Reference: logOut()
Guest Purchases
Users can purchase without logging in. The SDK tracks these purchases by device:How Guest Purchases Work
| Scenario | Behavior |
|---|---|
| Purchase without login | Membership tied to device ID |
| Login after purchase | Membership claimed by user account |
| Same user, new device | Memberships sync after login |
| Logout | Device memberships remain; user memberships hidden |
Device ID
The SDK automatically manages a unique device identifier stored in the iOS Keychain:Checking Current User
Access the currently logged-in user ID:FAQ
What if a user purchases on two devices before logging in?
What if a user purchases on two devices before logging in?
When they log in on either device, both device-level memberships are claimed by their account. The next time they log in on the other device, all memberships sync.
Can I migrate existing users to WhopIAP?
Can I migrate existing users to WhopIAP?
Yes. When users log in with
logIn(appUserId:), use the same user ID you have in your existing system. Their memberships (if purchased through Whop) will sync automatically.What happens if the user ID changes?
What happens if the user ID changes?
Avoid changing user IDs. If you must, the old user retains their memberships and the new user ID starts fresh.
How do I handle family sharing or multiple accounts per device?
How do I handle family sharing or multiple accounts per device?
Call
logOut() when switching accounts, then logIn(appUserId:) with the new user. Each user’s memberships load independently.Quick Reference
| Method/Property | Purpose |
|---|---|
isSubscribed() | Check access to any configured product |
hasAccess(to:) | Check access to specific product |
memberships | Array of active memberships |
logIn(appUserId:) | Associate user with device purchases |
logOut() | Clear user session |
appUserId | Current logged-in user ID (or nil) |
deviceId | Unique device identifier |

