Endpoint
POST /merchants/transactions/b2c
Description
Initiates a fund transfer to the user’s DCash account. The transaction flow works as follows:
Transfer to DCash
Funds are transferred from your merchant account to the user’s DCash account
Withdraw to Provider
Funds are then withdrawn from the user’s DCash account and sent to the specified payment provider
Complete
Transaction completes and response is returned
Merchant API key for authentication
Body Parameters
Merchant-provided unique identifier for the transaction
Brief description of the withdrawal
Provider to process the withdrawal (e.g., “mpesa”, “airtel”)If not specified, the user’s default withdrawal provider will be used
Currency code (e.g., “USD”)
Response
Unique identifier for the transaction
Merchant-provided reference ID (if provided)
Status of the transaction (e.g., “completed”)
Email of the user who received the withdrawal
Description of the transaction
Timestamp of completion (format: YYYYMMDDHHMMSS)
Example Request
curl --request POST \
--url https://sandbox.dcash.africa/merchants/transactions/b2c \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_MERCHANT_API_KEY' \
--data '{
"reference_id": "abcd",
"description": "Test withdrawal",
"payment_provider": "mpesa",
"email": "[email protected]",
"amount": 10,
"currency": "USD"
}'
Example Response
{
"transaction_id": "skjr7",
"reference_id": "abcd",
"transaction_status": "completed",
"user_email": "[email protected]",
"amount": 10,
"currency": "USD",
"description": "Test withdrawal",
"date_completed": 20250401125109
}
Important Notes
Ensure you have sufficient balance in your merchant account before initiating withdrawals.
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