Withdrawals

Send money from wallets to M-Pesa or bank accounts. Withdrawals are processed via M-Pesa B2C for mobile money.

API Reference

Get Withdrawal Providers

Create Withdrawal

Get Withdrawal Status

Withdrawal Flow

  1. Funds are reserved from the wallet
  2. M-Pesa B2C request is sent to Safaricom
  3. Customer receives money in M-Pesa
  4. Webhook is sent with final status

Fees

ProviderFee
M-Pesa35 KES flat
Bank Transfer75 KES flat

Testing in Sandbox

Sandbox wallets start with 0 KES balance. You need to deposit funds first you can use for testing withdrawals. In sandbox mode, withdrawals use the real M-Pesa B2C API to send money to real phone numbers.

Code Examples

withdrawals.js
const BASE = 'https://api.wasaapay.com/api/v1/partner';
const headers = { 'X-API-Key': process.env.WASAAPAY_API_KEY };
// List providers and fees
const providers = await fetch(`${BASE}/withdrawals/providers`, { headers });
const { data } = await providers.json();
// Initiate M-Pesa withdrawal
const res = await fetch(`${BASE}/withdrawals`, {
method: 'POST',
headers: { ...headers, 'Content-Type': 'application/json', 'X-Idempotency-Key': crypto.randomUUID() },
body: JSON.stringify({
walletId: 'wallet_abc123',
amount: 1000,
provider: 'MPESA',
phoneNumber: '+254712345678',
}),
});
const { data: withdrawal } = await res.json();
console.log('Withdrawal ID:', withdrawal.id, 'Status:', withdrawal.status);
// Poll for status
const status = await fetch(`${BASE}/withdrawals/${withdrawal.id}`, { headers });
const { data: updated } = await status.json();