Bulk disbursements (1-1000 items)
curl --request POST \
--url https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotency_key": "<string>",
"items": [
{
"msisdn": "<string>",
"amount": 123,
"idempotency_key": "<string>",
"reference": "<string>",
"narrative": "<string>"
}
],
"till_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pin": "<string>"
}
'import requests
url = "https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements"
payload = {
"idempotency_key": "<string>",
"items": [
{
"msisdn": "<string>",
"amount": 123,
"idempotency_key": "<string>",
"reference": "<string>",
"narrative": "<string>"
}
],
"till_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pin": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
idempotency_key: '<string>',
items: [
{
msisdn: '<string>',
amount: 123,
idempotency_key: '<string>',
reference: '<string>',
narrative: '<string>'
}
],
till_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
pin: '<string>'
})
};
fetch('https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements', 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://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '<string>',
'items' => [
[
'msisdn' => '<string>',
'amount' => 123,
'idempotency_key' => '<string>',
'reference' => '<string>',
'narrative' => '<string>'
]
],
'till_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'pin' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements"
payload := strings.NewReader("{\n \"idempotency_key\": \"<string>\",\n \"items\": [\n {\n \"msisdn\": \"<string>\",\n \"amount\": 123,\n \"idempotency_key\": \"<string>\",\n \"reference\": \"<string>\",\n \"narrative\": \"<string>\"\n }\n ],\n \"till_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"pin\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"<string>\",\n \"items\": [\n {\n \"msisdn\": \"<string>\",\n \"amount\": 123,\n \"idempotency_key\": \"<string>\",\n \"reference\": \"<string>\",\n \"narrative\": \"<string>\"\n }\n ],\n \"till_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"pin\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"<string>\",\n \"items\": [\n {\n \"msisdn\": \"<string>\",\n \"amount\": 123,\n \"idempotency_key\": \"<string>\",\n \"reference\": \"<string>\",\n \"narrative\": \"<string>\"\n }\n ],\n \"till_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"pin\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": {
"ok": true,
"code": 123,
"desc": "<string>"
},
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "collection",
"status": "queued",
"total_count": 123,
"total_amount": 123,
"counts": {},
"errors": {},
"created_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}Merchant rails
Bulk disbursements (1-1000 items)
kind: collections (needs collect) or disbursements (needs disburse). The whole
batch is validated first; a custodial payout batch must be covered by the main balance (amounts + fees) or
is refused. Answered 202, then items start in the background, each with its own idempotency key.
Track with GET .../bulk/{id} and list items with ?batch_id=.
Test environment: payout batches are refused with 403 live_mode_required.
POST
/
v1
/
merchants
/
{merchantID}
/
bulk
/
disbursements
Bulk disbursements (1-1000 items)
curl --request POST \
--url https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"idempotency_key": "<string>",
"items": [
{
"msisdn": "<string>",
"amount": 123,
"idempotency_key": "<string>",
"reference": "<string>",
"narrative": "<string>"
}
],
"till_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pin": "<string>"
}
'import requests
url = "https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements"
payload = {
"idempotency_key": "<string>",
"items": [
{
"msisdn": "<string>",
"amount": 123,
"idempotency_key": "<string>",
"reference": "<string>",
"narrative": "<string>"
}
],
"till_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"pin": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
idempotency_key: '<string>',
items: [
{
msisdn: '<string>',
amount: 123,
idempotency_key: '<string>',
reference: '<string>',
narrative: '<string>'
}
],
till_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
pin: '<string>'
})
};
fetch('https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements', 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://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'idempotency_key' => '<string>',
'items' => [
[
'msisdn' => '<string>',
'amount' => 123,
'idempotency_key' => '<string>',
'reference' => '<string>',
'narrative' => '<string>'
]
],
'till_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'pin' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements"
payload := strings.NewReader("{\n \"idempotency_key\": \"<string>\",\n \"items\": [\n {\n \"msisdn\": \"<string>\",\n \"amount\": 123,\n \"idempotency_key\": \"<string>\",\n \"reference\": \"<string>\",\n \"narrative\": \"<string>\"\n }\n ],\n \"till_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"pin\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"idempotency_key\": \"<string>\",\n \"items\": [\n {\n \"msisdn\": \"<string>\",\n \"amount\": 123,\n \"idempotency_key\": \"<string>\",\n \"reference\": \"<string>\",\n \"narrative\": \"<string>\"\n }\n ],\n \"till_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"pin\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudpay.africa/cloudpay/v1/merchants/{merchantID}/bulk/disbursements")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"idempotency_key\": \"<string>\",\n \"items\": [\n {\n \"msisdn\": \"<string>\",\n \"amount\": 123,\n \"idempotency_key\": \"<string>\",\n \"reference\": \"<string>\",\n \"narrative\": \"<string>\"\n }\n ],\n \"till_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"pin\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": {
"ok": true,
"code": 123,
"desc": "<string>"
},
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"merchant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"kind": "collection",
"status": "queued",
"total_count": 123,
"total_amount": 123,
"counts": {},
"errors": {},
"created_by": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}{
"status": {
"ok": false,
"code": 422,
"desc": "Unprocessable Entity"
},
"errors": {
"code": "insufficient_funds",
"message": "insufficient funds"
}
}Authorizations
merchantKeybearer & merchantId
Body
application/json