> ## 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.

# Uitbetalingen voor subaccounts inschakelen

> Laat je subaccounts hun eigen uitbetalingen beheren met Whop Elements of een gehost portaal

Laat je subaccounts zelf de Know Your Customer-verificatie (KYC) voltooien, uitbetalingsmethoden toevoegen en hun geld opnemen. Je kunt de wallet-onderdelen van [Whop Elements](https://docs.whop.com/nl/elements/latest/getting-started.md) rechtstreeks in je app mounten of gebruikers doorsturen naar een portaal dat door Whop wordt gehost.

## Ingesloten uitbetalingsportaal

### Implementatie aan de serverkant

Genereer op je server een toegangstoken voor het subaccount om de wallet-elements te mounten. De elements lezen daarmee het saldo en de uitbetalingen van dat account uit. Zie [Auth & API-sleutels](https://docs.whop.com/nl/developer/guides/auth-scoping.md) voor hoe je de scope van dat token bepaalt en hoe het zich verhoudt tot de andere typen inloggegevens van Whop.

```tsx Next.JS theme={null}
// app/api/token/route.ts
import { WhopClient } from "@whop/sdk";
import type { NextRequest } from "next/server";

const whop = new WhopClient({
	token: process.env.WHOP_API_KEY,
});

export async function GET(request: NextRequest) {
	// Authenticate your user here
	const accountId = request.nextUrl.searchParams.get("accountId");

	if (!accountId) {
		return new Response(null, { status: 400 });
	}
	const tokenResponse = await whop.accessTokens
		.create({
			account_id: accountId,
		})
		.catch(() => {
			return null;
		});
	if (!tokenResponse) {
		return new Response(null, { status: 500 });
	}
	const token = tokenResponse.token;
	return Response.json({
		token,
	});
}
```

```typescript Express.js theme={null}
import express from "express";
import { WhopClient } from "@whop/sdk";

const app = express();
const client = new WhopClient({ token: "Account API Key" });

app.use(express.json());

app.post("/api/access-token", async (req, res) => {
	// Authenticate your user here
	const { accountId } = req.body;

	const { token } = await client.accessTokens.create({
		account_id: accountId,
	});

	res.json({ token });
});

app.listen(3000, () => {
	console.log("Server running on port 3000");
});
```

```python Python theme={null}
from whop_sdk import Whop
from flask import Flask, request, jsonify

app = Flask(__name__)
client = Whop(token="Account API Key")

@app.route('/api/access-token', methods=['POST'])
def create_access_token():
    data = request.get_json()
    # Authenticate your user here
    account_id = data.get('accountId')

    access_token = client.access_tokens.create(
        account_id=account_id
    )

    return jsonify({'token': access_token.token})
```

> [card] [API voor het aanmaken van toegangstokens](https://docs.whop.com/nl/api-reference/legacy/access-tokens/create-access-token.md)
>
> Bekijk de volledige API-referentie voor het genereren van toegangstokens en alle beschikbare
> parameters

## Installatie aan de clientkant

```bash npm theme={null}
npm install @whop/elements-react @whop/elements
```

```bash pnpm theme={null}
pnpm add @whop/elements-react @whop/elements
```

```html HTML theme={null}
<script src="https://cdn.whop.com/elements/amber/elements.js" data-whop-elements></script>
```

## Implementatie aan de clientkant

Maak één `Wallet`-handle aan voor het subaccount en mount de onderdelen die je nodig hebt eronder. De handle stuurt zijn toegangstoken naar elk element eronder, dus genereer één token met elke scope die die elements nodig hebben om te lezen.

```tsx React theme={null}
"use client";

import { useEffect, useState } from "react";
import {
	ActivityElement,
	BalanceElement,
	Balances,
	Wallet,
	WhopElements,
	WithdrawElement,
} from "@whop/elements-react";
import { loadWhop } from "@whop/elements";

export function PayoutPortal({ accountId }: { accountId: string }) {
	const [accessToken, setAccessToken] = useState<string | null>(null);

	useEffect(() => {
		fetch(`/api/token?accountId=${accountId}`)
			.then((res) => res.json())
			.then((data) => setAccessToken(data.token));
	}, [accountId]);

	if (!accessToken) return null;

	return (
		<WhopElements elements={loadWhop()}>
			<Wallet accountId={accountId} accessToken={accessToken}>
				<Balances>
					<BalanceElement />
				</Balances>
				<WithdrawElement />
				<ActivityElement />
			</Wallet>
		</WhopElements>
	);
}
```

```html JavaScript theme={null}
<div id="balance"></div>
<div id="withdraw"></div>
<div id="activity"></div>

<script type="module">
  const accountId = "biz_xxxxxxxxxxxxx";
  const { token } = await (await fetch(`/api/token?accountId=${accountId}`)).json();

  const wallet = window.WhopElements().wallet.create({ accountId, accessToken: token });
  wallet.create("balances").create("balance").mount("#balance");
  wallet.create("withdraw").mount("#withdraw");
  wallet.create("activity").mount("#activity");
</script>
```

> [!NOTE]
>
> Op iOS bevat de wallet-SDK `BalanceElement`, `ListElement` en `ActivityElement`. Zie [Aan de slag met Elements](https://docs.whop.com/nl/elements/latest/getting-started.md) en kies het tabblad Swift.

### Identiteitsverificatie

Een subaccount moet zijn identiteit verifiëren voordat het geld kan opnemen. Mount het [KYC-element](https://docs.whop.com/nl/elements/latest/verifications/kyc.md) voor de volledige flow op de pagina, die de gegevens verzamelt, de gehoste sessie van de provider uitvoert en het resultaat rapporteert. Of mount het [RequiredActions-element](https://docs.whop.com/nl/elements/latest/dashboard/required-actions.md) om elke openstaande actie te tonen, inclusief verificatie, en de gebruiker elke actie te laten starten.

```tsx React theme={null}
import { WhopElements, Verifications, KycElement } from "@whop/elements-react";
import { loadWhop } from "@whop/elements";

export function VerifyIdentity({ accountId }: { accountId: string }) {
	return (
		<WhopElements elements={loadWhop()}>
			<Verifications
				accountId={accountId}
				getToken={() =>
					fetch(`/api/token?accountId=${accountId}`)
						.then((res) => res.json())
						.then((data) => data.token)
				}
			>
				<KycElement onCompleted={() => console.log("Verified")} />
			</Verifications>
		</WhopElements>
	);
}
```

## `Wallet`-opties

| Optie | Type | Vereist | Beschrijving |
| - | - | - | - |
| `accountId` | `string` | Ja | Het ID van het subaccount, met prefix `biz_`. |
| `accessToken` | `string` | Ja, op je eigen domein | Het token van je server. Zonder token gebruiken leesacties de whop.com-sessie van de kijker, wat alleen werkt op whop.com. |
| `currency` | `string` | Nee | ISO 4217-code voor bedragvelden. Standaard `usd`. |
| `appearance` | `Appearance` | Nee | Thema en styling per onderdeel voor elk element onder de handle. Zie [Appearance](https://docs.whop.com/nl/elements/latest/appearance.md). |

Elke optie, elk event en elke methode staat in de [Wallet-referentie](https://docs.whop.com/nl/elements/latest/wallet/overview).

### Scopes

De elements lezen met het token dat je genereert, dus ken elke scope die ze nodig hebben toe aan dat ene token:

* [Balances](https://docs.whop.com/nl/elements/latest/wallet/balances) en [Activity](https://docs.whop.com/nl/elements/latest/wallet/activity.md) lezen met `company:balance:read`.
* [Withdraw](https://docs.whop.com/nl/elements/latest/wallet/withdraw.md) heeft `payout:withdraw_funds`, `payout:destination:read` en `payout:create_destination` nodig om een bank toe te voegen.
* [KYC](https://docs.whop.com/nl/elements/latest/verifications/kyc.md) heeft `identity:read` en `identity:write` nodig.

Een token dat zonder `scoped_actions` is aangemaakt, erft elke permissie van je API-sleutel.

### Het token vernieuwen

Toegangstokens verlopen standaard na één uur en uiterlijk na drie uur. Stel een nieuw token in op de handle voordat het verloopt:

```ts theme={null}
wallet.update({ accessToken: await fetchToken(accountId) });
```

Geef in React de nieuwe waarde door als de prop `accessToken`.

> [!NOTE]
>
> `accessToken` is een waarde die je instelt, geen callback die de SDK aanroept. `Verifications` is de uitzondering: dat accepteert een `getToken`-callback en roept deze aan voordat het element wordt gemount.

## Gehost uitbetalingsportaal

In plaats van het uitbetalingsportaal in je app in te sluiten, kun je gebruikers doorsturen naar een uitbetalingsportaal dat door Whop wordt gehost. Dit is handig wanneer je geen eigen UI wilt bouwen of een snelle integratie nodig hebt.

Maak een accountlink aan en stuur de gebruiker door naar de teruggegeven URL:

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

const client = new WhopClient({
	token: "Account API Key",
});

const accountLink = await client.accountLinks.create({
	account_id: "biz_xxxxxxxxxxxxx",
	use_case: "payouts_portal",
	return_url: "https://yourapp.com/payouts/complete",
	refresh_url: "https://yourapp.com/payouts/refresh",
});

// Redirect the user to the hosted portal
console.log(accountLink.url);
```

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

client = Whop(
    token="Account API Key",
)

account_link = client.account_links.create(
    account_id="biz_xxxxxxxxxxxxx",
    use_case="payouts_portal",
    return_url="https://yourapp.com/payouts/complete",
    refresh_url="https://yourapp.com/payouts/refresh",
)

# Redirect the user to the hosted portal
print(account_link.url)
```

```rust Rust theme={null}
use whop_sdk::prelude::*;

let config = ClientConfig {
    token: Some("Account API Key".to_string()),
    ..Default::default()
};
let client = Whop::new(config).expect("Failed to build client");

let account_link = client
    .account_links
    .create(
        &CreateAccountLinksRequest {
            account_id: "biz_xxxxxxxxxxxxx".to_string(),
            use_case: AccountLinkUseCases::PayoutsPortal,
            return_url: "https://yourapp.com/payouts/complete".to_string(),
            refresh_url: "https://yourapp.com/payouts/refresh".to_string(),
        },
        None,
    )
    .await?;

// Redirect the user to the hosted portal
println!("{}", account_link.url);
```

```go Go theme={null}
import (
    "context"
    "fmt"
    "log"

    whopsdk "github.com/whopio/whopsdk-go/v2"
    "github.com/whopio/whopsdk-go/v2/client"
    "github.com/whopio/whopsdk-go/v2/option"
)

client := client.NewWhop(option.WithToken("Account API Key"))

accountLink, err := client.AccountLinks.Create(context.TODO(), &whopsdk.CreateAccountLinksRequest{
    AccountID:  "biz_xxxxxxxxxxxxx",
    UseCase:    whopsdk.AccountLinkUseCasesPayoutsPortal,
    ReturnURL:  "https://yourapp.com/payouts/complete",
    RefreshURL: "https://yourapp.com/payouts/refresh",
})
if err != nil {
    log.Fatal(err)
}

// Redirect the user to the hosted portal
fmt.Println(accountLink.URL)
```

In dit voorbeeld:

* `account_id` is het platform of subaccount
* `use_case` bepaalt het type portaal
* `return_url` is waar Whop de gebruiker naartoe stuurt wanneer die wil terugkeren naar je site
* `refresh_url` is waar Whop de gebruiker naartoe stuurt als de sessie verloopt

### Beschikbare use cases

| Use case | Beschrijving |
| - | - |
| `account_onboarding` | KYC en identiteitsverificatie |
| `payouts_portal` | Uitbetalingen, uitbetalingsmethoden, KYC en identiteitsverificatie |

Stuur de gebruiker na het aanmaken van de accountlink door naar de `url` uit het antwoord. De gebruiker voltooit de uitbetalingsflow op het door Whop gehoste portaal, waarna Whop de gebruiker doorstuurt naar je `return_url`.

## Gerelateerde bronnen

> [card] [Wallet-elements](https://docs.whop.com/nl/elements/latest/wallet/overview)
>
> Elk wallet-onderdeel met zijn opties, events en scopes

> [card] [Subaccounts betalen](https://docs.whop.com/nl/developer/platforms/collect-payments-for-subaccounts.md)
>
> Maak geld over naar subaccounts


## Related topics

- [Handmatige uitbetalingen aan subaccounts](https://docs.whop.com/nl/developer/platforms/manual-payouts.md)
- [Voorbeeldintegratie](https://docs.whop.com/nl/developer/guides/example-integration.md)
- [Betalingen innen voor subaccounts](https://docs.whop.com/nl/developer/platforms/collect-payments-for-subaccounts.md)
