System Wallets
System wallets are organization-level wallets that allow partners to hold operational float, collect fees, manage settlements, and store revenue. Partners can transfer funds between their system wallets and their users' wallets.
Overview
Unlike user wallets which belong to individual users, system wallets belong to your partner organization. They serve different operational purposes and help you manage your platform's finances.
Wallet Purposes
You can use any custom purpose string for your system wallets. Common purposes include:
| Purpose | Description | Use Case |
|---|---|---|
| OPERATIONAL | Operational float for disbursements | Pre-fund to disburse to users instantly |
| FEES | Collection of transaction fees | Platform fees from user transactions |
| SETTLEMENT | Pool for settlements to users | Batch payouts to merchants/users |
| ESCROW | Holds funds during pending transactions | Marketplace escrow, dispute holds |
| COMMISSION | Commission earnings | Agent/affiliate commissions |
| REVENUE | General revenue/profit storage | Consolidated platform earnings |
Custom Purposes
You can create wallets with custom purposes for specific use cases. Purpose must be uppercase letters, numbers, and underscores only (2-50 characters). Examples:
ESCROW_ORDER_12345- Escrow for a specific orderESCROW_DISPUTE_789- Funds held for a disputePROJECT_ALPHA_FUND- Project-specific funding poolVENDOR_PAYOUTS_Q1- Quarterly vendor payment pool
Account Number Format
System wallet account numbers follow the format: PSW-{PARTNER_ID}-{PURPOSE}
For example: PSW-A1B2C3D4-OPS
Permissions
System wallet operations require specific permissions on your API key:
system-wallets:create- Create system walletssystem-wallets:read- View system wallets and balancessystem-wallets:manage- Transfer funds to/from user wallets
API Reference
Create System Wallet
List System Wallets
/partner/system-walletsGet System Wallet
/partner/system-wallets/:systemWalletIdGet System Wallet Balance
/partner/system-wallets/:systemWalletId/balanceGet System Wallet Transactions
/partner/system-wallets/:systemWalletId/transactionsTransfer to User Wallet
/partner/system-wallets/:systemWalletId/transferTransfer Between System Wallets
/partner/system-wallets/:systemWalletId/transfer-to-systemWebhooks
System wallet operations trigger the following webhook events:
system_wallet.created- When a system wallet is createdsystem_wallet.credited- When funds are added to a system walletsystem_wallet.debited- When funds are removed from a system walletsystem_wallet.transfer_completed- When a transfer completes
Use Cases
Disbursement Platform
Use an OPERATIONAL wallet as float to instantly pay out to users without waiting for external funding:
- Fund your operational wallet via bank transfer or M-Pesa
- When a payout is triggered, transfer from operational wallet to user
- Monitor balance and top up as needed
Marketplace with Escrow
Use an ESCROW wallet to hold funds during transactions:
- When buyer pays, transfer from their wallet to escrow (FROM_USER)
- When order is delivered/confirmed, transfer from escrow to seller (TO_USER)
- If disputed, hold in escrow until resolution
Multi-Wallet Fund Management
Use system-to-system transfers to manage funds across different purposes:
- Collect fees from transactions into
FEESwallet - Move accumulated fees to
REVENUEwallet periodically - Transfer from
REVENUEtoOPERATIONALto replenish float - Move funds from order-specific
ESCROW_ORDER_123toSETTLEMENTwhen orders complete
Fee Collection
Use a FEES wallet to collect platform fees:
- Configure fees on transactions (via split payments or manual)
- Fees automatically accumulate in the fees wallet
- Periodically withdraw to your bank account
Code Examples
Create Wallet and Disburse to User
1const API_KEY = process.env.WASAAPAY_API_KEY;2const BASE_URL = 'https://api.wasaapay.com/api/v1/partner';34// 1. Create an operational wallet5const createRes = await fetch(`${BASE_URL}/system-wallets`, {6 method: 'POST',7 headers: {8 'Content-Type': 'application/json',9 'X-API-Key': API_KEY,10 'X-Idempotency-Key': 'create-ops-wallet-001',11 },12 body: JSON.stringify({13 purpose: 'OPERATIONAL',14 name: 'Main Float Account',15 currency: 'KES',16 }),17});18const { data: wallet } = await createRes.json();19console.log('Wallet ID:', wallet.id);2021// 2. Disburse funds to a user wallet22const transferRes = await fetch(23 `${BASE_URL}/system-wallets/${wallet.id}/transfer`,24 {25 method: 'POST',26 headers: {27 'Content-Type': 'application/json',28 'X-API-Key': API_KEY,29 'X-Idempotency-Key': 'disburse-reward-001',30 },31 body: JSON.stringify({32 direction: 'TO_USER',33 userWalletId: 'wallet_user123',34 amount: 5000,35 narration: 'Cashback reward',36 externalReference: 'reward_jan_001',37 }),38 }39);40const { data: transfer } = await transferRes.json();41console.log('Transfer status:', transfer.status);
Escrow Workflow
1const API_KEY = process.env.WASAAPAY_API_KEY;2const BASE_URL = 'https://api.wasaapay.com/api/v1/partner';34async function createOrderEscrow(orderId, buyerWalletId, amount) {5 // 1. Create a per-order escrow wallet6 const createRes = await fetch(`${BASE_URL}/system-wallets`, {7 method: 'POST',8 headers: {9 'Content-Type': 'application/json',10 'X-API-Key': API_KEY,11 'X-Idempotency-Key': `create-escrow-${orderId}`,12 },13 body: JSON.stringify({14 purpose: `ESCROW_ORDER_${orderId}`,15 name: `Escrow for Order #${orderId}`,16 currency: 'KES',17 metadata: { orderId },18 }),19 });20 const { data: escrow } = await createRes.json();2122 // 2. Move buyer funds into escrow (FROM_USER)23 await fetch(`${BASE_URL}/system-wallets/${escrow.id}/transfer`, {24 method: 'POST',25 headers: {26 'Content-Type': 'application/json',27 'X-API-Key': API_KEY,28 'X-Idempotency-Key': `collect-${orderId}`,29 },30 body: JSON.stringify({31 direction: 'FROM_USER',32 userWalletId: buyerWalletId,33 amount,34 narration: `Payment for order #${orderId}`,35 }),36 });3738 return escrow.id;39}4041async function releaseEscrow(escrowWalletId, sellerWalletId, amount, orderId) {42 // Release funds to seller once order is confirmed43 await fetch(`${BASE_URL}/system-wallets/${escrowWalletId}/transfer`, {44 method: 'POST',45 headers: {46 'Content-Type': 'application/json',47 'X-API-Key': API_KEY,48 'X-Idempotency-Key': `release-${orderId}`,49 },50 body: JSON.stringify({51 direction: 'TO_USER',52 userWalletId: sellerWalletId,53 amount,54 narration: `Order #${orderId} payment released`,55 }),56 });57}