Installation
The WhopCheckout 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
Create an API Key
Before configuring the SDK, create an API key with theiap:read permission:
1
Go to Developer Settings
Navigate to Whop Developer Settings and select your app.
2
Create API Key
Click Create API Key and select only the
iap:read permission.3
Copy the key
Copy the generated API key. You’ll use this to configure the SDK.
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_) |
apiKey | Your API key with only the iap:read permission |
planMappings | Mapping of Whop plan IDs to Apple StoreKit product IDs |
Method Reference: configure()
Method Reference: configure()
WhopCheckoutError if configuration fails.Note: Call this once at app startup. Access the shared instance via Checkout.shared and pass it through the SwiftUI environment.Plan Mappings
TheplanMappings parameter maps your Whop plans to Apple StoreKit products. Pass an empty array [] if you don’t need StoreKit fallback.
In the US, the SDK uses Whop’s web checkout (2.7% + $0.30 fees). Outside the US, it can fall back to StoreKit (Apple’s 15-30% fees) if you provide plan mappings. The plan mapping tells the SDK which Apple product corresponds to each Whop plan.
- You create plans in Whop (e.g., “Monthly” for $9.99/month)
- You create matching products in App Store Connect with the same pricing and billing period
- You map them together in
Checkout.shared.configure()
Setting up products in App Store Connect
Setting up products in App Store Connect
- Go to App Store Connect and select your app
- Navigate to Monetization → Subscriptions (or In-App Purchases for one-time)
- Create a subscription group if you haven’t already
- Add products that match your Whop plans:
- Use a descriptive Product ID (e.g.,
com.yourapp.monthly) - Set the same price as your Whop plan
- Set the same billing period (monthly, yearly, etc.)
- Use a descriptive Product ID (e.g.,
- Submit the products for review (they must be approved before testing)
You can test with sandbox accounts before products are approved. See Apple’s testing guide.
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 Plan IDs
Where to find your Plan IDs
Plan IDs are found in your Whop Dashboard:
- Go to Whop Dashboard
- Click Products in the sidebar
- Select the product containing your plans
- Click on a Plan (e.g., “Monthly”, “Yearly”)
- The Plan ID is shown in the URL and the plan details:
Plan IDs start with
plan_. You’ll use these in the SDK’s configure() method to map Whop plans to Apple StoreKit products.Using the Environment
The SDK is an@Observable class, so you can pass it through SwiftUI’s environment:
Refreshing Plans
After initialization, you can refresh plans on-demand to get updated pricing or availability:- Updating prices after network recovery
- Reflecting server-side plan changes
- Implementing pull-to-refresh in subscription screens
FAQ
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 isInitialized before using other SDK methods.Is it safe to include the API key in my app?
Is it safe to include the API key in my app?
Yes, as long as the API key only has the
iap:read permission. This permission is specifically designed for client-side use and limits what the key can access. Never use an API key with broader permissions in your iOS app.Do I need a backend?
Do I need a backend?
No. The SDK handles authentication directly using your API key. No backend token endpoint is required.
Are webhooks sent when using the SDK?
Are webhooks sent when using the SDK?
Yes. All standard Whop webhooks are sent for purchases made through the SDK:
membership.went_valid- When a subscription becomes activemembership.went_invalid- When a subscription expires or is cancelledpayment.succeeded- When a payment completespayment.failed- When a payment fails
The SDK handles subscription status entirely client-side via
checkout.isSubscribed. Webhooks are only needed if you have server-side logic that needs to know about purchases.Next Steps
Purchasing
Learn how to display plans and handle the checkout flow

