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:planMappings:)
Configures and initializes the SDK. Call this once at app startup.
Example:
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.
Returns:
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.
Returns:
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
For Apple Pay, use
Checkout.ApplePayButton, or
presentApplePay(_:) when your UI triggers Apple Pay
from a custom interaction.logIn(appUserId:)
Logs in a user and claims any unclaimed memberships associated with the device.
Example:
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.When is membership nil?
When is membership nil?
The Key point: Don’t rely on
membership property depends on the payment method used:Why StoreKit purchases return nil:
StoreKit transactions are processed asynchronously by Apple. When the purchase completes, the SDK may not yet have the Whop membership synced. The SDK tracks StoreKit entitlements separately, so
checkout.isSubscribed will still return true.How to handle both cases:membership being non-nil to grant access. Always use checkout.isSubscribed or checkout.hasAccess(to:) to check subscription status.PlanMapping
A mapping between a Whop plan and an Apple StoreKit product, used during SDK configuration. This tells the SDK which Apple product to use for StoreKit purchases outside the US.PlanMapping vs CheckoutPlan:
PlanMapping is for SDK configuration
(mapping IDs). CheckoutPlan is what you display in your UI (has pricing,
titles, etc.). You create PlanMapping objects in configure(), then access
CheckoutPlan objects via checkout.plans.
Example:
PaymentMethod
The payment method to use for a purchase.Apple Pay is not included in
PaymentMethod — it has its own surfaces:
Checkout.ApplePayButton and
presentApplePay(_:).Checkout.ApplePayButton
A pre-built SwiftUI view that renders Apple’s official Apple Pay button and handles the entire purchase flow. You must use this component (orPKPaymentButton / PayWithApplePayButton) when offering Apple Pay — custom-styled buttons are not permitted by Apple’s Human Interface Guidelines.
Example:
presentApplePay(_:)
Presents the Apple Pay sheet directly, for UIs that initiate Apple Pay from a custom interaction (for example a slide-to-pay control) instead of the pre-built button.WhopCheckoutError.cancelled when the user dismisses the sheet.
Checkout.ApplePayButton.
CheckoutPlan (Display)
A subscription plan available for purchase, accessed viacheckout.plans. Use this for displaying plan information in your UI and for making purchases.
CheckoutPlan vs Plan:
CheckoutPlan contains full plan details (pricing,
titles, trial info) for your UI. Plan is just an ID mapping used during SDK
configuration. You never create CheckoutPlan objects—they come from
checkout.plans after configuration.CheckoutMembership
An active subscription membership.WhopCheckoutError
Errors thrown by the SDK.Apple Pay Eligibility
App Store Review Guidelines
Apple’s App Store Review Guideline 3.1.1 requires that digital goods and services (premium features, subscriptions, content unlocks, virtual currency) must use In-App Purchase (StoreKit). Apple Pay is explicitly prohibited for these transactions. Apple Pay is permitted under Guideline 3.1.3(e) and the Apple Pay guidelines for purchasing physical goods and real-world services.Qualifying Apps
Apps that can use Apple Pay (Checkout.ApplePayButton):
Apps that must use StoreKit (
.storeKit) or Whop web checkout (.whop):
How to Choose
Checkout.ApplePayButton. If you’re unsure whether your app qualifies, default to .whop (US) or .storeKit (elsewhere) — the SDK handles this automatically when you call purchase() without specifying a method.
Requirements
- iOS 17.0+
- Xcode 15.0+
- Swift 5.10+

