Create Transfer
Create a transfer between wallets within the WEpayments platform.
Request Body
Source wallet UUID to transfer from.Example: wallet-uuid-source
Destination wallet UUID to transfer to.Example: wallet-uuid-destination
Transfer amount in the smallest currency unit (e.g., 100 cents to transfer R$1.00).Min: 1, Max: 15000000
Currency code of the amount (ISO 4217).Length: 3 charactersExample: BRL
Description or purpose of the transfer.Max length: 255 characters
Your internal reference ID for this transfer.Max length: 255 characters
Response
WEpayment’s auto generated transfer ID.
Transfer amount in cents.
Your internal reference ID.
Request Example
curl --request POST \
--url https://api.sandbox.wepayout.com.br/v2/payout/transfers \
--header 'Accept: application/json' \
--header 'Authorization: Bearer 123' \
--header 'Content-Type: application/json' \
--data '{
"source_wallet_id": "wallet-uuid-source",
"destination_wallet_id": "wallet-uuid-destination",
"amount": 10000,
"currency": "BRL",
"description": "Transfer between accounts",
"external_id": "TRANSFER-001"
}'
{
"id": 98765,
"source_wallet_id": "wallet-uuid-source",
"destination_wallet_id": "wallet-uuid-destination",
"amount": 10000,
"currency": "BRL",
"description": "Transfer between accounts",
"status": {
"id": 1,
"name": "Completed"
},
"external_id": "TRANSFER-001",
"created_at": "2024-06-13T11:00:00.000000Z",
"updated_at": "2024-06-13T11:00:00.000000Z"
}
Use Cases
Transfer Between Merchant Accounts
Transfer funds between different merchant accounts:async function transferBetweenAccounts(fromWallet, toWallet, amount) {
const transfer = await createTransfer({
source_wallet_id: fromWallet,
destination_wallet_id: toWallet,
amount,
currency: 'BRL',
description: 'Inter-account transfer',
external_id: `TRANSFER-${Date.now()}`
});
return transfer;
}
Split revenue between partners or sellers:async function splitRevenue(sourceWallet, splits) {
const transfers = [];
for (const split of splits) {
const transfer = await createTransfer({
source_wallet_id: sourceWallet,
destination_wallet_id: split.walletId,
amount: split.amount,
currency: 'BRL',
description: `Revenue split - ${split.name}`,
external_id: `SPLIT-${split.id}`
});
transfers.push(transfer);
}
return transfers;
}
// Usage
await splitRevenue('main-wallet-uuid', [
{ walletId: 'partner1-wallet', amount: 5000, name: 'Partner 1', id: 'P1' },
{ walletId: 'partner2-wallet', amount: 3000, name: 'Partner 2', id: 'P2' }
]);
Consolidate funds from multiple wallets into one:async function consolidateFunds(sourceWallets, destinationWallet) {
const transfers = [];
for (const source of sourceWallets) {
// Get balance of source wallet
const balance = await getWalletBalance(source.walletId);
if (balance > 0) {
const transfer = await createTransfer({
source_wallet_id: source.walletId,
destination_wallet_id: destinationWallet,
amount: balance,
currency: 'BRL',
description: `Consolidation from ${source.name}`,
external_id: `CONSOLIDATE-${source.id}`
});
transfers.push(transfer);
}
}
return transfers;
}
Release funds from escrow to recipient:async function releaseEscrow(escrowWallet, recipientWallet, amount, orderId) {
const transfer = await createTransfer({
source_wallet_id: escrowWallet,
destination_wallet_id: recipientWallet,
amount,
currency: 'BRL',
description: `Escrow release for order ${orderId}`,
external_id: `ESCROW-${orderId}`
});
return transfer;
}
Best Practices
Check Balance First: Always verify the source wallet has sufficient balance before creating a transfer.
Wallet Validation: Ensure both source and destination wallet UUIDs are valid and belong to accounts you have access to.
Use External ID: Always provide an external_id to track transfers in your system and prevent duplicates.
Instant Transfers: Transfers between wallets are typically instant. Ensure your system can handle immediate balance updates.
Transfer Status
| Status ID | Status Name | Description |
|---|
| 1 | Completed | Transfer completed successfully |
| 2 | Failed | Transfer failed |
| 3 | Pending | Transfer is pending |