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.
Create your first top up in the dashboard
Before using the API, you need to create a top up from the Dashboard. This saves a payment method that you can reuse programmatically. Get payment methods
List saved payment methods for your company:const paymentMethods = await client.paymentMethods.list({
company_id: "biz_xxxxxxxxxxxxx",
});
const paymentMethod = paymentMethods.data[0];
Create a top up
const topup = await client.topups.create({
company_id: "biz_xxxxxxxxxxxxx",
amount: 1000.0,
currency: "usd",
payment_method_id: paymentMethod.id,
});
console.log(topup.id);
In this example:
company_id is your platform’s company ID
amount is the amount to add to your balance
currency is the currency of the top up
payment_method_id is the saved payment method to charge
Handle payment events
Listen for payment webhooks to confirm the top up was successful:if (webhookData.type === "payment.succeeded") {
const payment = webhookData.data;
console.log("Top up successful:", payment.id);
}
if (webhookData.type === "payment.failed") {
const payment = webhookData.data;
console.log("Top up failed:", payment.failure_message);
}
Collect payments for connected accounts
Transfer funds to connected accounts
Render payout portal
Let users withdraw their funds