Purchasing
The WhopCheckout SDK handles the entire purchase flow: displaying a checkout sheet, processing payment, and updating membership status automatically.
Displaying Available Plans
Access your plans through the checkout.plans array. Each plan includes pricing and display information:
Plans are fetched during configure(). The plans array will be empty until
configuration completes successfully. You can refresh plans later using
refreshPlans().
Property Reference: CheckoutPlan
| Property | Type | Description | |----------|------|-------------| | id |
String | Plan ID (starts with plan_) | | title | String? | Display
name | | description | String? | Description text | | initialPrice |
Double | Price amount | | baseCurrency | String | ISO currency code
(e.g., “USD”) | | planType | PlanType | .oneTime or .renewal | |
renewalPeriod | RenewalPeriod? | .monthly, .yearly, etc. |
Initiating a Purchase
Call purchase() with a plan ID. The SDK presents a checkout sheet, handles payment, and returns when complete:
What Happens During Purchase
Checkout sheet appears
The SDK presents a native sheet with the Whop payment form (US) or StoreKit (elsewhere).
Method Reference: purchase()
Parameters:
planId: The plan ID to purchase (starts withplan_)method: Optional override for payment method (.whopor.storeKit). For Apple Pay, useCheckout.ApplePayButtoninstead.
Returns: CheckoutPurchaseResult with receiptId and membership details.
Throws:
WhopCheckoutError.cancelled- User dismissed checkoutWhopCheckoutError.notConfigured- SDK not configuredWhopCheckoutError.paymentFailed(String)- Payment was declined
Handling Purchase Results
The CheckoutPurchaseResult gives you confirmation details:
Property Reference: CheckoutPurchaseResult
Membership properties:
Error Handling
Always handle the possible error cases:
Don’t treat WhopCheckoutError.cancelled as an error. Users commonly dismiss
checkout sheets to think about their purchase or check something else first.
Refreshing Plans
You can refresh plans after initialization to get updated pricing or availability:
Complete Example
A full paywall view combining plans display and purchasing:

