Appearance
Withdrawals
Requesting a withdrawal deducts the funds from the specific wallet's realBalance immediately and places the withdrawal in a PENDING state for back-office approval.
Requesting a Withdrawal
You must specify the walletId to deduct from.
javascript
try {
const result = await sdk.wallet.requestWithdrawal({
walletId: 'wallet_usd', // Must specify which wallet
amount: 100.00,
currency: 'USD',
method: 'BANK_TRANSFER' // or 'CRYPTO', 'CARD'
});
console.log(`Withdrawal requested. Transaction ID: ${result.transactionId}`);
// result.status will be 'PENDING'
} catch (error) {
// Will throw if the user does not have enough 'realBalance' in that specific wallet.
console.error(error.message);
}Important Rules
- Insufficient Funds: If
amount>realBalancefor the specified wallet, the SDK will throw an error. The frontend should catch this and display a UI error. - Bonus Funds: Bonus funds are strictly separated and cannot be withdrawn.
- Immediate Deduction: The user's available balance drops immediately to prevent them from withdrawing the same funds twice while the back-office reviews the request.