Home
Optional sponsorPayments and paywalls

Whop

Whop

Whop is an API for payments, checkout, subscriptions and payouts. Its iOS Checkout SDK adds in-app purchases and a paywall to a native iOS app.

Hackathon perks:To be confirmed

Good to know

  • You can add a paywall or a subscription to your app.
  • The sandbox uses no real money. You can buy a plan in the demo with a test card.

Get started

  1. 1

    Use the sandbox

    Sign up at sandbox.whop.com. Sandbox and production share no accounts, keys or products.

    sandbox.whop.com
  2. 2

    Create a key for the app

    In Dashboard → Developer, create an API key with the iap:read permission. Only this scoped key may ship in an app; never put an account API key in mobile code.

  3. 3

    Add the iOS Checkout SDK

    In Xcode, choose File → Add Package Dependencies and enter the repository URL. It needs iOS 17 or later.

    https://github.com/whopio/whopsdk-checkout-swift.git
  4. 4

    Configure it and gate a screen

    MyApp.swift
    import SwiftUI
    import WhopCheckout
    
    @main
    struct MyApp: App {
        var body: some Scene {
            WindowGroup {
                ContentView()
                    .environment(Checkout.shared)
                    .task {
                        try? await Checkout.shared.configure(
                            companyId: "biz_xxxxxxxxxxxxxx",
                            apiKey: "your_api_key_here",
                            planMappings: [
                                .init(whopId: "plan_xxxxx", appleId: "monthly_sub")
                            ]
                        )
                    }
            }
        }
    }
    
    struct ContentView: View {
        @Environment(Checkout.self) var checkout
    
        var body: some View {
            if checkout.isSubscribed {
                Text("Welcome, premium user!")
            } else {
                Button("Upgrade to Premium") {
                    Task {
                        try? await checkout.purchase("plan_xxxxx")
                    }
                }
            }
        }
    }
  5. 5

    Handle payments on the server

    Keep the full API key on a server, such as a Convex action, and listen for the payment.succeeded webhook.

    npm install @whop/sdk
    export WHOP_ENVIRONMENT=sandbox
    export WHOP_API_KEY=your_sandbox_key
    Whop developer quickstart
Ask Capy for a paywall
Add a Whop paywall to the iOS app with the WhopCheckout Swift package, following https://docs.whop.com/developer/guides/ios/overview.md. Gate the premium screens on checkout.isSubscribed and read the company id, scoped key and plan id from config.
NextSupermemory