Endpoint
POST /merchants/transactions/c2b
Description
Initiates a fund transfer on behalf of the user. The transaction flow works as follows:
Check Balance
System checks if the user’s DCash balance is sufficient
Initiate Deposit
If insufficient, a deposit transaction is initiated with the specified payment provider
Transfer Funds
Once the deposit succeeds, funds are transferred to the merchant account
Webhook Notification
The provided webhook is called with transaction details
Merchant API key for authentication
Bearer token of the authenticated userFormat: Bearer {token}
Body Parameters
Merchant-provided unique identifier for tracking
Description of the deposit transaction
Payment provider to use (e.g., “mpesa”, “airtel”)Must be one of the providers returned by the Get Payment Providers endpoint
Currency code (e.g., “USD”)
URL to receive transaction completion notification
Response
Unique identifier for the transaction
Merchant-provided reference ID (if provided)
Current status of the transaction (e.g., “pending”)
Webhook Response
When the transaction completes, your webhook will receive:
Unique identifier for the transaction
Merchant-provided reference ID (if provided)
Status of the transaction (e.g., “completed”)
Email of the user who made the deposit
Description of the transaction
Timestamp of completion (format: YYYYMMDDHHMMSS)
Example Request
curl --request POST \
--url https://sandbox.dcash.africa/merchants/transactions/c2b \
--header 'Authorization: Bearer YOUR_USER_TOKEN' \
--header 'Content-Type: application/json' \
--header 'x-api-key: YOUR_MERCHANT_API_KEY' \
--data '{
"reference_id": "abcd",
"description": "Test Deposit",
"payment_provider": "mpesa",
"amount": 10,
"currency": "USD",
"webhook_url": "https://api.paymaxis.com/webhook/dcash"
}'
Example Response
{
"transaction_id": "skjr3",
"reference_id": "abcd",
"transaction_status": "pending"
}
When you receive a “completed” status in your webhook, the funds have been successfully transferred to your merchant account.