Skip to main content
POST
https://sandbox.dcash.africa
/
merchants
/
transactions
/
c2b
Deposits (C2B)
curl --request POST \
  --url https://sandbox.dcash.africa/merchants/transactions/c2b \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <x-api-key>' \
  --data '
{
  "reference_id": "<string>",
  "description": "<string>",
  "payment_provider": "<string>",
  "amount": 123,
  "currency": "<string>",
  "webhook_url": "<string>"
}
'
{
  "transaction_id": "<string>",
  "reference_id": "<string>",
  "transaction_status": "<string>",
  "user_email": "<string>",
  "amount": 123,
  "currency": "<string>",
  "description": "<string>",
  "date_completed": 123
}

Endpoint

POST /merchants/transactions/c2b

Description

Initiates a fund transfer on behalf of the user. The transaction flow works as follows:
1

Check Balance

System checks if the user’s DCash balance is sufficient
2

Initiate Deposit

If insufficient, a deposit transaction is initiated with the specified payment provider
3

Transfer Funds

Once the deposit succeeds, funds are transferred to the merchant account
4

Webhook Notification

The provided webhook is called with transaction details
If the webhook is not triggered, use the Check Transaction Status endpoint to verify the transaction status.

Headers

x-api-key
string
required
Merchant API key for authentication
Authorization
string
required
Bearer token of the authenticated userFormat: Bearer {token}

Body Parameters

reference_id
string
Merchant-provided unique identifier for tracking
description
string
Description of the deposit transaction
payment_provider
string
required
Payment provider to use (e.g., “mpesa”, “airtel”)Must be one of the providers returned by the Get Payment Providers endpoint
amount
number
required
Amount to deposit
currency
string
required
Currency code (e.g., “USD”)
webhook_url
string
required
URL to receive transaction completion notification

Response

transaction_id
string
Unique identifier for the transaction
reference_id
string
Merchant-provided reference ID (if provided)
transaction_status
string
Current status of the transaction (e.g., “pending”)

Webhook Response

When the transaction completes, your webhook will receive:
transaction_id
string
Unique identifier for the transaction
reference_id
string
Merchant-provided reference ID (if provided)
transaction_status
string
Status of the transaction (e.g., “completed”)
user_email
string
Email of the user who made the deposit
amount
number
Amount deposited
currency
string
Currency code
description
string
Description of the transaction
date_completed
number
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.