Data
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer_id: '<string>', product_name: '<string>', reference: '<string>'})
};
fetch('https://app.datashop.africa/api/v2/purchase', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.datashop.africa/api/v2/purchase \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "<string>",
"product_name": "<string>",
"reference": "<string>"
}
'import requests
url = "https://app.datashop.africa/api/v2/purchase"
payload = {
"customer_id": "<string>",
"product_name": "<string>",
"reference": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.datashop.africa/api/v2/purchase",
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([
'customer_id' => '<string>',
'product_name' => '<string>',
'reference' => '<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;
}Purchases
Data
Buy a data product for a phone number.
POST
/
api
/
v2
/
purchase
Data
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({customer_id: '<string>', product_name: '<string>', reference: '<string>'})
};
fetch('https://app.datashop.africa/api/v2/purchase', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://app.datashop.africa/api/v2/purchase \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "<string>",
"product_name": "<string>",
"reference": "<string>"
}
'import requests
url = "https://app.datashop.africa/api/v2/purchase"
payload = {
"customer_id": "<string>",
"product_name": "<string>",
"reference": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.datashop.africa/api/v2/purchase",
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([
'customer_id' => '<string>',
'product_name' => '<string>',
'reference' => '<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;
}Submit a data purchase with the recipient number, selected product, and reference from your system. Keep the reference; it is used for status checks, receipts, and reconciliation.
Request body
string
required
Recipient phone number.
string
required
Data product selected from List products.
string
required
Unique transaction reference from your system. Must be 15 to 40 characters.
Request
{
"customer_id": "08030000000",
"product_name": "mtn-share-weekly-1gb",
"reference": "merchant-ref-20260812001"
}
Successful response
{
"status": true,
"message": "Purchase processed successfully.",
"data": {
"reference": "merchant-ref-20260812001",
"customer_id": "08030000000",
"service": "data",
"provider": "MTN",
"product_name": "mtn-share-weekly-1gb",
"quantity": "1GB",
"paid_amount": 400,
"transaction_status": "successful",
"remark": "Purchase successful"
}
}
Processing response
{
"status": true,
"message": "Purchase is processing.",
"data": {
"reference": "merchant-ref-20260812001",
"customer_id": "08030000000",
"service": "data",
"provider": "MTN",
"product_name": "mtn-share-weekly-1gb",
"quantity": "1GB",
"paid_amount": 400,
"transaction_status": "processing"
}
}
Failed response
{
"status": false,
"message": "Error message"
}
⌘I