The iOS WhopIAP SDK is coming soon. This documentation is a preview.
Installation
The WhopIAP SDK is distributed via Swift Package Manager.1
Add package dependency
In Xcode, go to File → Add Package Dependencies and enter:
2
Select version
Choose your preferred version rule:
- Up to Next Major - Recommended for most projects
- Exact Version - For strict version control
3
Import the SDK
Backend Setup
Your backend needs an endpoint that returns a Whop access token with theiap:client scope. This token authenticates your app’s payment requests.
- Next.js
- Express
- Python (FastAPI)
Access Tokens API
See the full API reference for creating access tokens
SDK Configuration
Initialize the SDK once at app startup, typically in yourApp struct:
Configuration Parameters
| Parameter | Description |
|---|---|
companyId | Your Whop company ID (starts with biz_) |
productIds | Array of product IDs to manage (starts with prod_) |
accessTokenProvider | Async closure that fetches tokens from your backend |
Method Reference: configure()
Method Reference: configure()
WhopIAPError.tokenUnavailable if the initial token fetch fails.Note: Call this once at app startup. Calling it multiple times has no effect.Finding Your IDs
Where to find your Company ID
Where to find your Company ID
Your company ID is in the URL when viewing your Whop Dashboard:

Where to find your Product IDs
Where to find your Product IDs
Find product IDs in the Products tab of your Whop Dashboard. Click on a product to see its ID in the URL or details panel.

Using the Environment
The SDK is an@Observable class, so you can pass it through SwiftUI’s environment:
FAQ
What happens when the token expires?
What happens when the token expires?
The SDK automatically calls your
accessTokenProvider closure when it needs a fresh token. You don’t need to handle token refresh manually.Can I configure the SDK later (not at startup)?
Can I configure the SDK later (not at startup)?
Yes, but the SDK won’t function until
configure() completes. Check whop.isInitialized before using other SDK methods.What if my backend is temporarily unavailable?
What if my backend is temporarily unavailable?
Next Steps
Purchasing
Learn how to display plans and handle the checkout flow

