Skip to main content

Use cases

  1. Create a checkout configuration
  2. Onboard sub-merchants
  3. Verify your platform account
  4. Programmatically pay out users
  5. Generate payout onboarding links for your sub-merchants
pnpm install @whop/sdk
Before you begin, follow the Quickstart to create an API key.

Troubleshoot API requests

Debug authentication failures, permission errors, retryable responses, and sandbox/production mismatches.
from whop_sdk import Whop, BadRequestError
import random

client = Whop(
    api_key="YOUR_API_KEY",
)

your_company_id = "YOUR_COMPANY_ID"

# 1. Create a checkout configuration
checkout = client.checkout_configurations.create(
    currency="usd",
    plan={
        "initial_price": 10.0,
        "plan_type": "one_time",
        "company_id": your_company_id,
        "currency": "usd",
        "payment_method_configuration": {
            "enabled": [
                "crypto", # low fees
                "us_bank_transfer", # very low fees
                "apple_pay", # standard cc rates
            ],
            "disabled": [
                "acss_debit",
                "affirm",
                "afterpay_clearpay",
                "alipay",
                "alma",
                "amazon_pay",
            ],
        },
    },
    metadata={
        "order_id": "order_12345",
    },
)

checkout_link = f"https://whop.com/checkout/{checkout.plan.id}"
print(f"\n✅ Checkout created → {checkout_link}\n   (redirect customers here to pay or embed it)")
input("\nPress Enter to continue...")

# 2. Onboard sub-merchants to pay them out
sub_merchant = client.companies.create(
    email="merchant@example.com",
    parent_company_id=your_company_id,
    title="Acme Merchant Store #" + str(random.randint(1, 200)),
    # logo=FileAttachment("https://example.com/logo.png"),
    metadata={
        "internal_user_id": "user_12345",
        "seller_tier": "gold",
    },
)
print(f"\n✅ Sub-merchant onboarded → {sub_merchant.id}")

# 2.5 Verify your platform account (skip if already done)
# Your account must be verified to send transfers.
print(f"\n🔐 Verify your platform account:\n   https://whop.com/payouts/{your_company_id}/verify/")
input("\nPress Enter when done...")

# 3. Programmatically pay out users
while True:
    try:
        transfer = client.transfers.create(
            amount=1.0,
            currency="usd",
            origin_id=your_company_id,
            destination_id=sub_merchant.id,
            metadata={"reason": "creator_payout"},
        )
        print(f"\n✅ Transfer complete → {transfer.id}")
        break
    except BadRequestError as e:
        print(f"\n❌ Transfer failed: {e}")
        input("\nFix the issue above, then press Enter to retry...")


# 4. Generate a payout onboarding link for your sub-merchant
# Short-lived URL — send to the sub-merchant to complete identity verification and payout setup.
account_link = client.account_links.create(
    company_id=sub_merchant.id,
    refresh_url="https://yourapp.com/onboarding/refresh",
    return_url="https://yourapp.com/onboarding/complete",
    use_case="account_onboarding",
)
print(f"\n✅ Send to sub-merchant for payout setup:\n   {account_link.url}")

API Keys

Use Account API keys when you only want to fetch data or perform actions for your own Account and connected accounts.
  1. Follow the Quickstart API key steps and open Account API Keys.
  2. Click the “Create” button in the “Account API Keys” section
  3. Give your api key a name. For example “Data pipeline” or “GHL Integration”
  4. Select a role or a custom set of permissions. (You can always update this later and add more if you need)
  5. Create the api key, and copy it from the modal.
Use app API keys when you are building an app and need to access data on companies that have installed your app.
  1. Follow the Quickstart API key steps and open Apps.
  2. Click the Create app button and give your app a name. You can change this name later.
  3. Your API key is the hidden text after WHOP_API_KEY in the Environment variables section. Use the reveal button to show the key, copy it and keep it in a safe place. You will need it to make API calls.
Use OAuth tokens when you want users to sign in with their Whop account and grant your app permission to act on their behalf. Unlike API keys which use your app’s permissions, OAuth tokens are scoped to what each individual user can access.Common use cases:
  • “Sign in with Whop” authentication
  • Accessing a user’s memberships, purchases, or profile
  • Performing actions as a specific user (not as your app)
OAuth tokens are obtained through the OAuth 2.1 + PKCE flow:
  1. Redirect users to Whop’s authorization page
  2. User logs in and approves your requested scopes
  3. Exchange the authorization code for access and refresh tokens
  4. Use the access token as your API key in SDK calls or the Authorization header
See the OAuth guide for full implementation details.

Making API calls

Our public api is available at https://api.whop.com/api/v1 You can test the api by using curl to fetch your public user profile data:
# replace "j" with your own whop username
curl https://api.whop.com/api/v1/users/j
To make authenticated requests you need to include your API key in the Authorization header using the Bearer scheme:
# replace "YOUR_API_KEY" with your real API key
curl https://api.whop.com/api/v1/payments?company_id=biz_xxxxxxxxxxx \
    -H "Authorization: Bearer YOUR_API_KEY"

SDK Reference

MCP

You can also access the API via our mcp server available at https://mcp.whop.com/mcp (cursor) or https://mcp.whop.com/sse (claude) Learn more here