Get Payment Providers
curl --request GET \
--url https://sandbox.dcash.africa/merchants/accounts/providers \
--header 'Authorization: <authorization>' \
--header 'x-api-key: <x-api-key>'import requests
url = "https://sandbox.dcash.africa/merchants/accounts/providers"
headers = {
"x-api-key": "<x-api-key>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', Authorization: '<authorization>'}
};
fetch('https://sandbox.dcash.africa/merchants/accounts/providers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.dcash.africa/merchants/accounts/providers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.dcash.africa/merchants/accounts/providers"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.dcash.africa/merchants/accounts/providers")
.header("x-api-key", "<x-api-key>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.dcash.africa/merchants/accounts/providers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"default_deposit_provider": "<string>",
"default_withdraw_provider": "<string>",
"payment_providers": {
"mobile_payment_providers": [
{
"provider_name": "<string>",
"phone_number": "<string>"
}
]
}
}User Management
Get Payment Providers
Retrieve available payment providers for the authenticated user
GET
/
merchants
/
accounts
/
providers
Get Payment Providers
curl --request GET \
--url https://sandbox.dcash.africa/merchants/accounts/providers \
--header 'Authorization: <authorization>' \
--header 'x-api-key: <x-api-key>'import requests
url = "https://sandbox.dcash.africa/merchants/accounts/providers"
headers = {
"x-api-key": "<x-api-key>",
"Authorization": "<authorization>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', Authorization: '<authorization>'}
};
fetch('https://sandbox.dcash.africa/merchants/accounts/providers', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.dcash.africa/merchants/accounts/providers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"x-api-key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.dcash.africa/merchants/accounts/providers"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-api-key", "<x-api-key>")
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.dcash.africa/merchants/accounts/providers")
.header("x-api-key", "<x-api-key>")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.dcash.africa/merchants/accounts/providers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<x-api-key>'
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"default_deposit_provider": "<string>",
"default_withdraw_provider": "<string>",
"payment_providers": {
"mobile_payment_providers": [
{
"provider_name": "<string>",
"phone_number": "<string>"
}
]
}
}Endpoint
GET /merchants/accounts/providers
Description
Retrieves a list of all payment providers available to the current user and their chosen defaults. Only the listed payment providers can be used to initiate a transaction.Headers
string
required
Merchant API key for authentication
string
required
Bearer token of the authenticated userFormat:
Bearer {token}Response
string
User’s default provider for deposits
string
User’s default provider for withdrawals
object
Example Request
curl --request GET \
--url https://sandbox.dcash.africa/merchants/accounts/providers \
--header 'Authorization: Bearer YOUR_USER_TOKEN' \
--header 'x-api-key: YOUR_MERCHANT_API_KEY'
const response = await fetch('https://sandbox.dcash.africa/merchants/accounts/providers', {
method: 'GET',
headers: {
'x-api-key': 'YOUR_MERCHANT_API_KEY',
'Authorization': 'Bearer YOUR_USER_TOKEN'
}
});
const data = await response.json();
console.log(data);
import requests
url = "https://sandbox.dcash.africa/merchants/accounts/providers"
headers = {
"x-api-key": "YOUR_MERCHANT_API_KEY",
"Authorization": "Bearer YOUR_USER_TOKEN"
}
response = requests.get(url, headers=headers)
data = response.json()
print(data)
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://sandbox.dcash.africa/merchants/accounts/providers");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"x-api-key: YOUR_MERCHANT_API_KEY",
"Authorization: Bearer YOUR_USER_TOKEN"
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data);
?>
Example Response
{
"default_deposit_provider": "mpesa",
"default_withdraw_provider": "airtel",
"payment_providers": {
"mobile_payment_providers": [
{
"provider_name": "mpesa",
"phone_number": "254797954425"
},
{
"provider_name": "airtel",
"phone_number": "254780764974"
}
]
}
}
The providers returned by this endpoint are the only ones that can be used when initiating deposit or withdrawal transactions for this user.
Error Codes
| Code | Message |
|---|---|
authorization_token_not_found | please provide an authorization token |
application_not_authorized | application is not authorized |
missing_api_key | please provide an api key |
invalid_api_key | api key does not exist |
internal_server_error | internal server error |
Use Cases
This endpoint is useful for:- Displaying available payment options to users
- Pre-selecting the user’s default payment provider
- Validating payment provider selections before initiating transactions
- Building dynamic payment forms based on user preferences