Withdrawals (B2C)
Transactions
Withdrawals (B2C)
Initiate a business-to-customer withdrawal transaction
POST
Withdrawals (B2C)
Endpoint
Description
Initiates a fund transfer to the user’s DCash account. The transaction flow works as follows:Withdraw to Provider
If payment provider is provided in the request, funds are withdrawn from the user’s DCash account and sent to the specified payment provider. Otherwise, the funds remain in the user’s DCash account
Body Parameters
Merchant-provided unique identifier for the transaction
Brief description of the withdrawal
Provider to process the withdrawal (e.g., “mpesa”, “airtel”)
User’s email address
Amount to withdraw
Currency code (e.g., “USD”)
Response
Unique identifier for the transaction
Merchant-provided reference ID (if provided)
Status of the transaction (e.g., “completed”)
Amount withdrawn
Currency code
Timestamp of completion (format: YYYYMMDDHHMMSS)
Example Request
Example Response
Important Notes
Unlike deposits, withdrawals typically complete synchronously and return the full transaction details in the immediate response.
Use Cases
Common scenarios for B2C withdrawals:- Payouts: Sending earnings or rewards to users
- Refunds: Processing refund requests
- Cashouts: Allowing users to withdraw their balance
- Disbursements: Distributing funds to multiple recipients
Error Codes
| Code | Message |
|---|---|
missing_api_key | please provide an api key |
invalid_api_key | api key does not exist |
invalid_email | invalid email address |
user_not_found | user not found |
invalid_currency | invalid currency |
user_not_active | user not active |
user_balance_not_found | user balance not found |
merchant_not_active | merchant not active |
merchant_balance_not_found | merchant balance not found |
invalid_amount | invalid amount |
insufficient_balance | insufficient balance |
reference_already_used | a transaction with the reference id exists |
internal_server_error | internal server error |