Skip to main content
This quickstart runs in the sandbox, a separate Whop environment where money never moves. You’ll get a sandbox API key, make your first call, create a checkout, pay it with a test card, and receive the payment.succeeded webhook on your server. Going live is the last step, and it’s mostly swapping keys.
If you use a coding agent, give it this page as Markdown, https://docs.whop.com/developer/quickstart.md, or paste the prompt from the Overview.

Sandbox and production

Whop runs two environments that share nothing: not accounts, not keys, not products, not webhooks. You build in the sandbox and launch in production. Every value below changes between them.
Sandbox and production API keys look identical, so nothing in a key tells you which environment it belongs to. The snippets on this page pick the environment from a WHOP_ENVIRONMENT variable rather than hardcoding it, so the same code runs in both. The Whop MCP server only acts on production data.

Get a sandbox API key

1

Sign up for the sandbox

Go to sandbox.whop.com and create an account. It’s separate from any account you have on whop.com. The sign-up flow creates your first business, which is the Account that owns API keys, products, webhooks, and payments.
2

Create an Account API key

Open sandbox.whop.com/dashboard/developer. In Account API Keys, select Create, and name the key something like Local development.For this quickstart, use the Admin role. Before production, switch to a custom permission set that covers only the endpoints you call.
3

Store the key on your server

Copy the key when Whop shows it, and put it in your local .env file with the environment it belongs to:
Whop dashboard Account API Keys section showing a key name, masked value, and Create button
Keep WHOP_API_KEY on your server. Don’t put API keys in browser code, mobile apps, or public repositories. Sandbox and production keys look identical, so name them so you can tell them apart.
An Account API key is right when your server acts for your own business. To build an app other businesses install, or to let users sign in with Whop, see Auth & API keys.

Install the SDK

This page needs SDK 2.7.0 or later. Earlier versions don’t accept the inline variant on checkout configurations.

Make your first call

Point the client at the environment named in WHOP_ENVIRONMENT and retrieve the account behind your key. This confirms the key works, and prints your account ID, which starts with biz_.
That’s your sandbox account. The key works.

Create a checkout

One call creates a variant and returns a purchase_url, a checkout page hosted on sandbox.whop.com.
You’ll open this URL in the payment step. If you already have a variant, pass its ID as variant_id instead of the inline variant. You can’t send both. Create Checkout Configuration lists every option, including recurring pricing, trials, and redirect URLs.

Listen for the webhook

Set up your endpoint before you pay, so the payment.succeeded event has somewhere to land.
1

Add an endpoint

Add a POST route that verifies the signature and logs the event. Verification needs the raw request body, so read it before any JSON parsing.
While you develop, expose the route over HTTPS with ngrok, Cloudflare Tunnel, or another tunnel.
2

Create the webhook in the sandbox dashboard

Open Developer > Webhooks in the sandbox dashboard, then select Create webhook. Paste the HTTPS address of your endpoint, keep the API version on v1, and select payment.succeeded.
Create webhook form showing the payment_succeeded event selected in the events list
3

Store the signing secret

Copy the secret from the webhook’s Secret column and add it to .env exactly as shown, ws_ prefix included:
Restart your server so it picks up the new value.

Pay with a test card

Open the purchase_url from the checkout step and pay with: Within a few seconds, your server logs payment.succeeded and the payment ID, which starts with pay_.
You’ve taken a payment and handled its webhook, end to end. Nothing was charged.
To test a declined card or 3D Secure, use the other numbers in Test cards. If nothing arrives, check the delivery log on the webhook in the dashboard and Webhook delivery.

Go live

Sandbox and production share nothing, so going live means repeating the setup on whop.com with production credentials. Your code doesn’t change. Only the values in your environment do.
1

Create a production key

Sign in at whop.com, open whop.com/dashboard/developer, and create an Account API key with only the permissions your integration uses.
2

Swap every value for its production twin

In your production environment, set all three variables to production values. Never reuse a sandbox key or secret in production, or the reverse.
If you call the API directly, switch the base URL to https://api.whop.com/api/v1.
3

Recreate what you made in the sandbox

Products, variants, checkout configurations, and webhooks don’t carry over. Create the production webhook against your production URL and store its new signing secret.
4

Pin your API version

The SDK sends the version it was built against. If you call the API directly, send Api-Version-Date on every request so later changes don’t alter your responses. See API versioning.
Production checkout links take real money. Check which key you’re holding before running anything that creates a charge or moves a balance.

Now build what you came for

You sell a subscription or a one-time product

Checkout links, the Checkout element, variants, and trials.

You owe money to people who aren't you

Payouts, transfers, balances, and the payout portal.

You take a cut of what other people sell

Subaccounts, collecting on their behalf, and paying them out.

You want distribution, not just infrastructure

Apps that run inside Whop, with auth, views, and the CLI.

Your product needs people talking to each other

Chat, DMs, and forums you can embed.

You just want to read the reference

Every resource in the Current API, with a playground on each endpoint.