Get product
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.datashop.africa/api/v2/products/{product_name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.datashop.africa/api/v2/products/{product_name} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.datashop.africa/api/v2/products/{product_name}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.datashop.africa/api/v2/products/{product_name}",
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: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}Products and services
Get product
Get the current details for one product.
GET
/
api
/
v2
/
products
/
{product_name}
Get product
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://app.datashop.africa/api/v2/products/{product_name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://app.datashop.africa/api/v2/products/{product_name} \
--header 'Authorization: Bearer <token>'import requests
url = "https://app.datashop.africa/api/v2/products/{product_name}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.datashop.africa/api/v2/products/{product_name}",
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: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}Fetch one product immediately before checkout when you need a final read of price, availability, or validation. This is useful when the product list was loaded earlier and the customer is now ready to pay.
Parameters
string
required
Product name returned by List products, such as
mtn-share-weekly-1gb.Request
GET /api/v2/products/mtn-share-weekly-1gb
Authorization: Bearer YOUR_API_KEY
Successful response
{
"status": true,
"message": "Product fetched successfully.",
"data": {
"service": "data",
"product_name": "mtn-share-weekly-1gb",
"provider": "MTN",
"category": "weekly",
"sub_category": "share",
"description": "1GB weekly data bundle",
"quantity": "1GB",
"validity": "7 days",
"fixed_price": 400,
"amount_required": false,
"require_validation": false,
"available": true
}
}
Failed response
{
"status": false,
"message": "Error message"
}
⌘I