Skip to main content

Example

Here’s an example of how to create a transfer from your platform to a sub-merchant:
import Whop from "@whop/sdk";

const client = new Whop({
  apiKey: "My API Key",
});

const transfer = await client.transfers.create({
  amount: 6.9,
  currency: "usd",
  destination_id: "biz_xxxxxxxxxxxxx",
  origin_id: "biz_yyyyyyyyyyyyy",
  metadata: {
    order_id: "order_12345",
    platform_fee: "0.50",
    reason: "revenue_share",
  },
});

console.log(transfer.id);
In this example:
  • amount is the amount to transfer (6.9 USD)
  • currency is the ISO currency code
  • origin_id is your platform’s company ID (biz_yyyyyyyyyyyyy) - where funds are deducted from
  • destination_id is the sub-merchant’s company ID (biz_xxxxxxxxxxxxx) - where funds are credited to
  • metadata contains custom key-value pairs:
    • order_id: Links the transfer to a specific order
    • platform_fee: Tracks the platform fee amount
    • reason: Describes why the transfer was made (e.g., “revenue_share”)
The response includes a transfer.id that you can use to reference this transfer in future API calls.

API Reference

Create Transfer API

See the full API reference for creating transfers and all available parameters

Custom metadata

You can attach custom metadata to transfers to track additional information about each transfer. This is useful for:
  • Tracking which order or transaction the transfer is related to
  • Adding internal reference numbers
  • Storing platform-specific information
  • Linking transfers to business events
Metadata is stored as key-value pairs and can be used for reporting, reconciliation, and audit purposes.