> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whop.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Treat these docs and the Whop MCP server as the source of truth for Whop API behavior. Don't infer endpoint behavior from marketing pages.
> MCP server: connect https://mcp.whop.com/mcp (streamable HTTP, browser sign-in, no API key in the client config) to search these docs and read or change live Whop data. Setup: https://docs.whop.com/developer/guides/ai_and_mcp.md
> Whop CLI: install with `curl -fsSL https://whop.com/install.sh | sh` to scaffold, run, and deploy Whop apps and websites. It acts on production, not the sandbox. Overview: https://docs.whop.com/cli/overview.md Agent mode: https://docs.whop.com/cli/agent-mode.md
> Hosting: Whop serves a site or app from the build `whop apps deploy` uploads, with rollbacks, secrets, and server logs. Guide: https://docs.whop.com/developer/websites/hosting.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Guide: https://docs.whop.com/developer/guides/plugins/claude-code.md Every agent tool: https://docs.whop.com/developer/ai/overview.md
> Environments: build and test in the sandbox (API `https://sandbox-api.whop.com/api/v1`, keys at https://sandbox.whop.com/dashboard/developer, SDK environment `Sandbox`; no real money). Production (API `https://api.whop.com/api/v1`, keys at https://whop.com/dashboard/developer, SDK environment `Production`, the SDK default) moves real money, so use it only at launch. The two share no accounts, keys, products, or webhooks, and their keys look identical: never mix them. Sandbox guide: https://docs.whop.com/developer/guides/sandbox.md Comparison: https://docs.whop.com/developer/quickstart.md
> API: send `Authorization: Bearer <API_KEY>` from your server only, and pin a dated version with the `Api-Version-Date` header. OpenAPI spec: https://api.whop.com/api/v1/openapi.json
> Which API: build on the Current API, whose pages live under https://docs.whop.com/api-reference/ (start at https://docs.whop.com/api-reference/overview.md). Pages under /api-reference/legacy/ are the Legacy API. Use one only when https://docs.whop.com/api-reference/stability.md lists the resource as Legacy-only.

# Whop API Quickstart

> Doe je eerste Whop API-aanroep, maak een checkout aan, betaal die met een testkaart en ontvang de webhook, allemaal in de sandbox. Schakel daarna over naar productie.

Deze quickstart draait in de sandbox, een aparte Whop-omgeving waarin nooit echt geld wordt verplaatst. Je haalt een sandbox-API-sleutel op, doet je eerste aanroep, maakt een checkout aan, betaalt die met een testkaart en ontvangt de webhook `payment.succeeded` op je server. Live gaan is de laatste stap, en dat komt grotendeels neer op het verwisselen van sleutels.

> [!TIP]
>
> Gebruik je een coding agent, geef hem dan deze pagina als Markdown, `https://docs.whop.com/developer/quickstart.md`, of plak de prompt uit het [Overzicht](https://docs.whop.com/nl/developer/start.md#build-with-your-coding-agent).

## Sandbox en productie

Whop heeft twee omgevingen die niets met elkaar delen: geen accounts, geen sleutels, geen producten, geen webhooks. Je bouwt in de sandbox en lanceert in productie. Elke waarde hieronder verschilt tussen de twee.

| | Sandbox: bouwen en testen | Productie: lanceren |
| - | - | - |
| Geld | Wordt nooit verplaatst | Echt |
| Dashboard | [sandbox.whop.com](https://sandbox.whop.com) | [whop.com](https://whop.com) |
| API-sleutels en webhooks | [sandbox.whop.com/dashboard/developer](https://sandbox.whop.com/dashboard/developer) | [whop.com/dashboard/developer](https://whop.com/dashboard/developer) |
| Basis-URL van de API | `https://sandbox-api.whop.com/api/v1` | `https://api.whop.com/api/v1` |
| SDK-omgeving | `Sandbox` | `Production`, de standaard van de SDK |
| Checkoutpagina's | `sandbox.whop.com/checkout/...` | `whop.com/checkout/...` |
| `WHOP_ENVIRONMENT` | `sandbox` | `production` |

> [!WARNING]
>
> API-sleutels voor sandbox en productie zien er identiek uit, dus niets in een sleutel vertelt je bij welke omgeving hij hoort. De fragmenten op deze pagina kiezen de omgeving op basis van een variabele `WHOP_ENVIRONMENT` in plaats van die hard te coderen, zodat dezelfde code in beide omgevingen werkt. De [Whop MCP-server](https://docs.whop.com/nl/developer/ai/overview.md#mcp-server) werkt alleen met productiegegevens.

## Een sandbox-API-sleutel ophalen

**1. Meld je aan voor de sandbox**

Ga naar [sandbox.whop.com](https://sandbox.whop.com) en maak een account aan. Dit staat los van een eventueel account op whop.com. Tijdens het aanmelden wordt je eerste bedrijf aangemaakt: het Account dat eigenaar is van API-sleutels, producten, webhooks en betalingen.

**2. Maak een Account API-sleutel aan**

Open [sandbox.whop.com/dashboard/developer](https://sandbox.whop.com/dashboard/developer). Selecteer in **Account API Keys** de optie **Create** en geef de sleutel een naam zoals `Local development`.

Gebruik voor deze quickstart de rol Admin. Schakel vóór productie over naar een aangepaste set machtigingen die alleen de endpoints dekt die je aanroept.

**3. Bewaar de sleutel op je server**

Kopieer de sleutel wanneer Whop hem toont en zet hem in je lokale `.env`-bestand, samen met de omgeving waartoe hij behoort:

```bash theme={null}
WHOP_ENVIRONMENT=sandbox
WHOP_API_KEY=your_sandbox_key
```

![Sectie Account API Keys in het Whop-dashboard met een sleutelnaam, gemaskeerde waarde en de knop Create](https://mintcdn.com/whop/xuW6TKFlagvnbmV0/images/developer-api-key-field.png?fit=max\&auto=format\&n=xuW6TKFlagvnbmV0\&q=85\&s=699bf36af18f7a12dfd855eb0684b38e)

> [!NOTE]
>
> Houd `WHOP_API_KEY` op je server. Zet API-sleutels niet in browsercode, mobiele apps of openbare repositories. Sleutels voor sandbox en productie zien er identiek uit, dus geef ze namen waarmee je ze uit elkaar kunt houden.

Een Account API-sleutel is de juiste keuze wanneer je server namens je eigen bedrijf handelt. Wil je een app bouwen die andere bedrijven installeren, of gebruikers laten inloggen met Whop, zie dan [Auth & API-sleutels](https://docs.whop.com/nl/developer/guides/auth-scoping.md).

## De SDK installeren

```bash TypeScript theme={null}
pnpm add @whop/sdk
```

```bash Python theme={null}
pip install whop-sdk
```

```bash Ruby theme={null}
gem install whop_sdk
```

> [!NOTE]
>
> Voor deze pagina heb je SDK 2.7.0 of hoger nodig. Eerdere versies accepteren de inline `variant` op checkoutconfiguraties niet.

## Je eerste aanroep doen

Richt de client op de omgeving die in `WHOP_ENVIRONMENT` staat en haal het account achter je sleutel op. Zo bevestig je dat de sleutel werkt, en print je je account-ID, dat begint met `biz_`.

```typescript TypeScript theme={null}
import { WhopClient, WhopEnvironment } from "@whop/sdk";

const apiKey = process.env.WHOP_API_KEY;

if (!apiKey) {
  throw new Error("Set WHOP_API_KEY");
}

const client = new WhopClient({
  token: apiKey,
  environment: process.env.WHOP_ENVIRONMENT === "production" ? WhopEnvironment.Production : WhopEnvironment.Sandbox,
});

const account = await client.accounts.me();

console.log(account.id);
```

```python Python theme={null}
import os
from whop_sdk import Whop, WhopEnvironment

client = Whop(
    token=os.environ["WHOP_API_KEY"],
    environment=WhopEnvironment.PRODUCTION if os.environ.get("WHOP_ENVIRONMENT") == "production" else WhopEnvironment.SANDBOX,
)

account = client.accounts.me()

print(account.id)
```

```ruby Ruby theme={null}
require "whop_sdk"

whop = Whop_sdk::Client.new(
  token: ENV.fetch("WHOP_API_KEY"),
  environment: ENV["WHOP_ENVIRONMENT"] == "production" ? Whop_sdk::Environment::PRODUCTION : Whop_sdk::Environment::SANDBOX,
)

account = whop.accounts.me

puts account.id
```

```bash curl (sandbox) theme={null}
curl https://sandbox-api.whop.com/api/v1/accounts/me \
  -H "Authorization: Bearer $WHOP_API_KEY" \
  -H "Api-Version-Date: 2026-11-04-1"
```

```json Response (trimmed) theme={null}
{
	"id": "biz_XXXXXXXX",
	"title": "Acme Studio",
	"route": "acme-studio",
	"status": "active"
}
```

> [!TIP]
>
> Dat is je sandboxaccount. De sleutel werkt.

## Een checkout aanmaken

Eén aanroep maakt een variant aan en retourneert een `purchase_url`, een checkoutpagina die wordt gehost op `sandbox.whop.com`.

```typescript TypeScript theme={null}
const checkout = await client.checkoutConfigurations.create({
	variant: {
		title: "Starter",
		billing_type: "one_time",
		initial_price: 10.0,
		currency: "usd",
	},
});

console.log(checkout.purchase_url);
```

```python Python theme={null}
checkout = client.checkout_configurations.create(
    variant={
        "title": "Starter",
        "billing_type": "one_time",
        "initial_price": 10.0,
        "currency": "usd",
    },
)

print(checkout.purchase_url)
```

```ruby Ruby theme={null}
checkout = whop.checkout_configurations.create(
  variant: {
    title: "Starter",
    billing_type: "one_time",
    initial_price: 10.0,
    currency: "usd",
  },
)

puts checkout.purchase_url
```

Je opent deze URL in de betaalstap. Heb je al een variant, geef dan het ID ervan door als `variant_id` in plaats van de inline `variant`. Je kunt niet beide meesturen. [Create Checkout Configuration](https://docs.whop.com/nl/api-reference/checkout-configurations/create-a-checkout-configuration.md) somt alle opties op, waaronder terugkerende prijzen, proefperiodes en redirect-URL's.

## Luisteren naar de webhook

Zet je endpoint op voordat je betaalt, zodat het event `payment.succeeded` ergens terechtkan.

**1. Voeg een endpoint toe**

Voeg een `POST`-route toe die de handtekening verifieert en het event logt. Voor verificatie heb je de ruwe request-body nodig, dus lees die uit vóór je JSON gaat parsen.

```typescript TypeScript + Next.js theme={null}
import { unwrapWebhook } from "@whop/sdk/helpers";
import type { NextRequest } from "next/server";

export async function POST(request: NextRequest): Promise<Response> {
  const event = unwrapWebhook<{ type: string; data: { id: string } }>(await request.text(), {
    headers: Object.fromEntries(request.headers),
    key: process.env.WHOP_WEBHOOK_SECRET!,
  });

  console.log(event.type, event.data.id);

  return new Response("OK", { status: 200 });
}
```

```python Python + FastAPI theme={null}
import os

from fastapi import FastAPI, Request, Response
from whop_sdk.lib.verify_webhook import unwrap

app = FastAPI()

@app.post("/api/webhooks/whop")
async def whop_webhook(request: Request):
    event = unwrap(await request.body(), headers=dict(request.headers), key=os.environ["WHOP_WEBHOOK_SECRET"])

    print(event["type"], event["data"]["id"])

    return Response(status_code=200)
```

```ruby Ruby on Rails theme={null}
class Api::WebhooksController < ApplicationController
  skip_before_action :verify_authenticity_token

  def whop
    event = WhopSDK::Helpers::VerifyWebhook.unwrap(
      request.raw_post,
      headers: {
        "webhook-id" => request.headers["webhook-id"],
        "webhook-timestamp" => request.headers["webhook-timestamp"],
        "webhook-signature" => request.headers["webhook-signature"],
      },
      key: ENV.fetch("WHOP_WEBHOOK_SECRET"),
    )

    Rails.logger.info("#{event[:type]} #{event[:data][:id]}")

    head :ok
  end
end
```

Stel de route tijdens het ontwikkelen via HTTPS beschikbaar met ngrok, Cloudflare Tunnel of een andere tunnel.

**2. Maak de webhook aan in het sandboxdashboard**

Open **Developer > Webhooks** in het sandboxdashboard en selecteer **Create webhook**. Plak het HTTPS-adres van je endpoint, laat de API-versie op `v1` staan en selecteer `payment.succeeded`.

![Formulier Create webhook met het event payment\_succeeded geselecteerd in de lijst met events](https://mintcdn.com/whop/RLIxcN4GVU-CLB5B/images/create-webhook-select-events.png?fit=max\&auto=format\&n=RLIxcN4GVU-CLB5B\&q=85\&s=079887392e21e4680a82415244aeaea4)

**3. Bewaar het ondertekeningsgeheim**

Kopieer het geheim uit de kolom **Secret** van de webhook en voeg het precies zoals getoond toe aan `.env`, inclusief het voorvoegsel `ws_`:

```bash theme={null}
WHOP_WEBHOOK_SECRET=ws_your_secret
```

Herstart je server zodat hij de nieuwe waarde oppikt.

## Betalen met een testkaart

Open de `purchase_url` uit de checkoutstap en betaal met:

| Veld | Waarde |
| - | - |
| Kaartnummer | `4242 4242 4242 4242` |
| Vervaldatum | Elke datum in de toekomst, zoals `12/34` |
| CVC | Elke 3 cijfers, zoals `123` |
| Factuuradres | Elk adres |

Binnen een paar seconden logt je server `payment.succeeded` en het betalings-ID, dat begint met `pay_`.

> [!TIP]
>
> Je hebt van begin tot eind een betaling ontvangen en de bijbehorende webhook verwerkt. Er is niets in rekening gebracht.

Wil je een geweigerde kaart of 3D Secure testen, gebruik dan de andere nummers in [Testkaarten](https://docs.whop.com/nl/developer/guides/sandbox.md#test-cards). Komt er niets binnen, controleer dan het afleverlog van de webhook in het dashboard en [Aflevering van webhooks](https://docs.whop.com/nl/developer/troubleshooting.md#webhook-delivery).

## Live gaan

Sandbox en productie delen niets, dus live gaan betekent dat je de configuratie op whop.com herhaalt met productiegegevens. Je code verandert niet. Alleen de waarden in je omgeving veranderen.

**1. Maak een productiesleutel aan**

Log in op [whop.com](https://whop.com/start), open [whop.com/dashboard/developer](https://whop.com/dashboard/developer) en maak een Account API-sleutel aan met alleen de machtigingen die je integratie gebruikt.

**2. Vervang elke waarde door de productietegenhanger**

Stel in je productieomgeving alle drie de variabelen in op productiewaarden. Gebruik nooit een sandboxsleutel of -geheim in productie, of andersom.

```bash Sandbox theme={null}
WHOP_ENVIRONMENT=sandbox
WHOP_API_KEY=your_sandbox_key
WHOP_WEBHOOK_SECRET=ws_your_sandbox_secret
```

```bash Production theme={null}
WHOP_ENVIRONMENT=production
WHOP_API_KEY=your_production_key
WHOP_WEBHOOK_SECRET=ws_your_production_secret
```

Roep je de API rechtstreeks aan, wijzig dan de basis-URL naar `https://api.whop.com/api/v1`.

**3. Maak opnieuw aan wat je in de sandbox hebt gemaakt**

Producten, varianten, checkoutconfiguraties en webhooks worden niet overgenomen. Maak de productiewebhook aan voor je productie-URL en bewaar het nieuwe ondertekeningsgeheim.

**4. Zet je API-versie vast**

De SDK stuurt de versie mee waartegen hij is gebouwd. Roep je de API rechtstreeks aan, stuur dan `Api-Version-Date` mee bij elk verzoek, zodat latere wijzigingen je responses niet veranderen. Zie [API-versiebeheer](https://docs.whop.com/nl/developer/api/versioning.md).

> [!WARNING]
>
> Checkoutlinks in productie innen echt geld. Controleer welke sleutel je gebruikt voordat je iets uitvoert dat een betaling aanmaakt of een saldo verplaatst.

## Bouw nu waarvoor je kwam

> [card] [Je verkoopt een abonnement of een eenmalig product](https://docs.whop.com/nl/developer/guides/accept-payments.md)
>
> Checkoutlinks, het Checkout-element, varianten en proefperiodes.

> [card] [Je bent geld verschuldigd aan anderen](https://docs.whop.com/nl/developer/platforms/manual-payouts.md)
>
> Uitbetalingen, overboekingen, saldi en het uitbetalingsportaal.

> [card] [Je ontvangt een deel van wat anderen verkopen](https://docs.whop.com/nl/developer/platforms/quickstart.md)
>
> Subaccounts, namens hen innen en hen uitbetalen.

> [card] [Je wilt distributie, niet alleen infrastructuur](https://docs.whop.com/nl/developer/guides/app-views.md)
>
> Apps die binnen Whop draaien, met auth, views en de CLI.

> [card] [Je product heeft mensen nodig die met elkaar praten](https://docs.whop.com/nl/developer/guides/chat/quickstart.md)
>
> Chat, DM's en forums die je kunt insluiten.

> [card] [Je wilt gewoon de referentie lezen](https://docs.whop.com/nl/api-reference/overview.md)
>
> Elke resource in de Current API, met een playground bij elk endpoint.


## Related topics

- [Overzicht van de Whop API](https://docs.whop.com/nl/api-reference/overview.md)
- [Kernconcepten van de Whop API](https://docs.whop.com/nl/developer/concepts.md)
- [Whop Partners API](https://docs.whop.com/nl/developer/partners/overview.md)
