Airtime
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '<string>',
product_name: '<string>',
amount: 123,
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>",
"amount": 123,
"reference": "<string>"
}
'import requests
url = "https://app.datashop.africa/api/v2/purchase"
payload = {
"customer_id": "<string>",
"product_name": "<string>",
"amount": 123,
"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>',
'amount' => 123,
'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
Airtime
Send airtime to a phone number.
POST
/
api
/
v2
/
purchase
Airtime
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '<string>',
product_name: '<string>',
amount: 123,
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>",
"amount": 123,
"reference": "<string>"
}
'import requests
url = "https://app.datashop.africa/api/v2/purchase"
payload = {
"customer_id": "<string>",
"product_name": "<string>",
"amount": 123,
"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>',
'amount' => 123,
'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 an airtime purchase with the recipient number, airtime product, amount, and reference.
amount is required for airtime and should be the top-up value to send to the recipient.
Request body
string
required
Recipient phone number.
string
required
Airtime product selected from List products.
number
required
Airtime top-up value to send to the recipient.
string
required
Unique transaction reference from your system. Must be 15 to 40 characters.
Request
{
"customer_id": "08030000000",
"product_name": "mtn-airtime",
"amount": 500,
"reference": "merchant-ref-20260812002"
}
Successful response
{
"status": true,
"message": "Purchase processed successfully.",
"data": {
"reference": "merchant-ref-20260812002",
"customer_id": "08030000000",
"service": "airtime",
"provider": "MTN",
"product_name": "mtn-airtime",
"quantity": 500,
"paid_amount": 500,
"transaction_status": "successful",
"remark": "Purchase successful"
}
}
Processing response
{
"status": true,
"message": "Purchase is processing.",
"data": {
"reference": "merchant-ref-20260812002",
"customer_id": "08030000000",
"service": "airtime",
"provider": "MTN",
"product_name": "mtn-airtime",
"quantity": 500,
"paid_amount": 500,
"transaction_status": "processing"
}
}
Failed response
{
"status": false,
"message": "Error message"
}
⌘I