Looking for guides? See Build a Paywall or Check Entitlements.
Checkout
The main class for managing in-app purchases. An@Observable class that can be used with SwiftUI’s environment system.
shared
The shared Checkout instance. Use this singleton to configure the SDK and manage purchases.configure(companyId:apiKey:plans:)
Configures and initializes the SDK. Call this once at app startup.| Parameter | Type | Description |
|---|---|---|
companyId | String | Your Whop company ID (starts with biz_) |
apiKey | String | Your API key with iap:read permission |
plans | [Plan] | Mapping of Whop plan IDs to Apple StoreKit product IDs (required for StoreKit purchases outside the US) |
isInitialized
Indicates whether the SDK has finished initializing.deviceId
The unique device identifier managed by the SDK. Persists across app launches using the iOS Keychain.appUserId
The current logged-in user ID, ornil if no user is logged in.
plans
Array of available subscription plans for the configured products.memberships
Array of active memberships for the current user or device.isSubscribed
Whether the user has any active membership.supportsExternalPurchases
Whether the current App Store region supports external (non-StoreKit) purchases. Currentlytrue for US users, false elsewhere.
true, the SDK defaults to Whop web checkout (lower fees). When false, it defaults to StoreKit.
refreshPlans()
Refreshes the available plans from the server.WhopCheckoutError if the refresh fails.
Call this to update pricing or plan availability after initialization. The plans property will also be updated with the latest data.
Example:
hasAccess(to:)
Checks if the user has access to a specific product.| Parameter | Type | Description |
|---|---|---|
productId | String | The product ID to check (starts with prod_) |
true if the user has an active membership for the product
Example:
purchase(_:method:)
Initiates a purchase flow for a plan. By default, uses Whop web checkout in the US (lower fees) and StoreKit elsewhere.| Parameter | Type | Description |
|---|---|---|
whopPlanId | String | The Whop plan ID to purchase (starts with plan_) |
method | PaymentMethod? | Override the payment method. Defaults based on region. |
CheckoutPurchaseResult containing the receipt ID and membership information
Throws:
WhopCheckoutError.cancelledif the user dismisses the checkoutWhopCheckoutError.notConfiguredif the SDK is not configuredWhopCheckoutError.paymentFailed(String)if the payment fails
logIn(appUserId:)
Logs in a user and claims any unclaimed memberships associated with the device.| Parameter | Type | Description |
|---|---|---|
appUserId | String | Your app’s user ID (should not change for the same user) |
logOut()
Logs out the current user and clears their memberships from the local state.restorePurchases()
Restores purchases from both StoreKit and Whop.true if any active subscription was found
Example:
Types
CheckoutPurchaseResult
The result of a successful purchase.| Property | Type | Description |
|---|---|---|
receiptId | String | The unique receipt ID for this purchase |
membership | CheckoutMembership? | The membership created by this purchase (nil for StoreKit-only purchases) |
Plan
Mapping between a Whop plan and an Apple StoreKit product. Required for StoreKit purchases outside the US.| Property | Type | Description |
|---|---|---|
whopId | String | The Whop plan ID (e.g., plan_xxx) |
appleId | String | The Apple product ID from App Store Connect (e.g., com.yourapp.monthly) |
Your Whop plans and Apple products should have matching pricing and billing periods. See Setup → Plan Mappings for details on configuring App Store Connect.
PaymentMethod
The payment method to use for a purchase.| Case | Description |
|---|---|
whop | Web checkout via Whop. 2.7% + $0.30 fees (vs Apple’s 15-30%). Available in the US. |
apple | StoreKit purchase via Apple (15-30% fees). Required outside the US. |
CheckoutPlan
A subscription plan available for purchase.| Property | Type | Description |
|---|---|---|
id | String | The plan ID |
productId | String? | The product this plan belongs to |
title | String? | Display name of the plan |
description | String? | Description text for the plan |
planType | PlanType | Whether this is a one-time or recurring plan |
billingPeriodDays | Int? | Number of days in billing cycle (30 = monthly, 365 = yearly) |
baseCurrency | String | Currency code (e.g., “usd”) |
initialPrice | Double | Initial price of the plan |
renewalPrice | Double | Price for renewals |
trialPeriodDays | Int? | Number of days in trial period |
renewalPeriod | RenewalPeriod? | Computed renewal period (.monthly, .yearly, etc.) |
whopDisplayPrice | String | Formatted Whop price (e.g., “$9.99”) |
appleDisplayPrice | String? | Localized StoreKit price, if a plan mapping exists |
CheckoutMembership
An active subscription membership.| Property | Type | Description |
|---|---|---|
id | String | The membership ID |
productId | String | The product this membership belongs to |
planId | String | The plan this membership is for |
status | Status | Current status of the membership |
isActive | Bool | Whether the membership grants access (true for active, trialing, canceling, pastDue, completed) |
isClaimed | Bool | Whether the membership has been claimed by a user |
createdAt | Date | When the membership was created |
expiresAt | Date? | When the membership expires |
renewalPeriodEnd | Date? | End of the current renewal period |
cancelAtPeriodEnd | Bool | Whether the membership will cancel at period end |
receiptId | String? | The receipt ID for this membership |
WhopCheckoutError
Errors thrown by the SDK.| Case | Description |
|---|---|
cancelled | User dismissed the checkout sheet without completing purchase |
notConfigured | SDK is not configured. Call Checkout.shared.configure() first. |
paymentFailed(String) | Payment failed. The associated string contains the error message. |
Requirements
- iOS 17.0+
- Xcode 16.0+
- Swift 5.10+

