For guides, see Build a
Paywall or Check
Entitlements.
Checkout
The main class for managing in-app purchases. SwiftUI’s environment system can use this@Observable class.
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 user’s ID, ornil for a guest.
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. Currently true for users in the United States and 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. This also updates the plans property 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 United States (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 isn’t 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 the SDK found an active subscription
Example:
Types
CheckoutPurchaseResult
The result of a successful purchase.
When's membership nil?
When's 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 also tracks StoreKit entitlements, 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 United States.
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 isn’t 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 (or PKPaymentButton / PayWithApplePayButton) when offering Apple Pay — custom-styled buttons aren’t 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 model
A subscription plan available for purchase, accessed via checkout.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.
Guideline 3.1.3(e) and the Apple Pay guidelines permit Apple Pay 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 (United States) 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+

