API Reference
This page documents all classes, methods, properties, and types available in the WhopCheckout SDK.
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.
Example:
configure(companyId:apiKey:planMappings:)
Configures and initializes the SDK. Call this once at app startup.
Parameters:
Example:
isInitialized
Indicates whether the SDK has finished initializing.
Example:
deviceId
The unique device identifier managed by the SDK. Persists across app launches using the iOS Keychain.
appUserId
The current logged-in user ID, or nil if no user is logged in.
plans
Array of available subscription plans for the configured products.
Example:
memberships
Array of active memberships for the current user or device.
isSubscribed
Whether the user has any active membership.
Example:
supportsExternalPurchases
Whether the current App Store region supports external (non-StoreKit) purchases. Currently true for US users, false elsewhere.
When true, the SDK defaults to Whop web checkout (lower fees). When false, it defaults to StoreKit.
refreshPlans()
Refreshes the available plans from the server.
Returns: The refreshed plans with current pricing.
Throws: 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.
Parameters:
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.
Parameters:
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
Example:
For Apple Pay, use Checkout.ApplePayButton
instead of calling purchase() directly. Apple’s Human Interface Guidelines
require the official branded button.
logIn(appUserId:)
Logs in a user and claims any unclaimed memberships associated with the device.
Parameters:
Example:
logOut()
Logs out the current user and clears their memberships from the local state.
Example:
restorePurchases()
Restores purchases from both StoreKit and Whop.
Returns: true if any active subscription was found
Example:
Types
CheckoutPurchaseResult
The result of a successful purchase.
When is membership nil?
The 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:
Key point: Don’t rely on 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:
Your Whop plans and Apple products should have matching pricing and billing periods. See Setup → Plan Mappings for details.
PaymentMethod
The payment method to use for a purchase.
Apple Pay is available via
Checkout.ApplePayButton — it is not included in
PaymentMethod because Apple’s HIG requires the official branded button.
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 are not permitted by Apple’s Human Interface Guidelines.
Parameters:
Example:
Apple Pay is not for digital content. Only use Checkout.ApplePayButton
if your app sells physical goods or real-world services. Apps selling digital
content (subscriptions to premium features, in-app currency, etc.) must use
StoreKit. See the Apple Pay eligibility section
below.
CheckoutPlan (Display)
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
Most apps should NOT use Apple Pay. Apple Pay via the WhopCheckout SDK is only for apps that sell physical goods or real-world services — not digital content, subscriptions to app features, or in-app currency.
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
If your app qualifies, use 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+

