API Playground
All API endpoints in this documentation include an interactive playground that allows you to test requests directly from your browser.Setup Your API Key
Before testing, you need to configure your authentication:1
Get Your Merchant API Key
Contact DCash support or log into your merchant dashboard to obtain your API key
2
Configure the Playground
Click the “Authorization” button in the playground and enter your API key in the
x-api-key field3
Add User Token (if needed)
For endpoints requiring user authentication, add the Bearer token in the
Authorization headerTest Credentials
For sandbox testing, use these credentials:Testing Different Endpoints
OAuth Login (Browser-based)
To test the OAuth flow:- Construct the URL manually:
- Replace
YOUR_APP_IDwith your actual app ID - Set a valid
redirect_urlfor your application - Open the URL in your browser
- Log in with the test credentials
- Complete the authentication flow
- Your webhook will receive the authorization token
Get Payment Providers
1
Set Authentication
Add both
x-api-key (merchant key) and Authorization (Bearer token)2
Send Request
Click the “Send” button to get the user’s available payment providers
Deposits (C2B)
1
Configure Headers
x-api-key: Your merchant API keyAuthorization: Bearer token from OAuth flow
2
Fill Request Body
3
Send Request
Click “Send” to initiate the deposit
4
Complete Payment
Check your phone for the M-Pesa prompt and complete the payment
Check Transaction Status
1
Get Transaction ID
Use the
transaction_id from a previous deposit or withdrawal2
Add API Key
Only
x-api-key is required (no user token needed)3
Send Request
Click “Send” to check the status
Withdrawals (B2C)
1
Configure Authentication
Add your
x-api-key in the authorization section2
Fill Request Body
3
Send Request
The withdrawal will be processed immediately
Troubleshooting
Invalid URL Error
Invalid URL Error
Make sure the base URL is configured correctly in the API settings. The base URL should be
https://sandbox.dcash.africa401 Unauthorized
401 Unauthorized
400 Bad Request
400 Bad Request
- Verify all required fields are included in the request body
- Check that the
payment_provideris from the list of available providers - Ensure amounts are valid numbers
Webhook Not Received
Webhook Not Received
- Verify your webhook URL is publicly accessible
- Use the “Check Transaction Status” endpoint to verify the transaction completed
- Check your webhook server logs for incoming requests
Best Practices
Use Valid Webhooks
Always use a real, publicly accessible webhook URL for testing deposits
Test Small Amounts
Start with small amounts (e.g., 10 USD) when testing
Save Tokens
Store your test Bearer tokens for reuse during testing
Check Providers First
Always call “Get Payment Providers” before initiating transactions
Next Steps
Ready to integrate? Check out the Authentication guide to get started with your application.