Overview
This section outlines the recommended flow for integrating Data Subscription services on the @jannah_opt('site_name') RESTful API.
Available Endpoints
To integrate the @jannah_opt('site_name') Data Subscription Payment RESTful API, the following parameters apply:
- network - The network provider
- phone - The recipient's phone number
- data_plan - The selected data plan
- bypass (boolean) - Whether to bypass verification
Purchase Product
To purchase a data bundle, use a POST request with the endpoint below:
@jannah_opt('site_url')/api/data
Code Sample
$payload = array(
'network' => 1,
'phone' => '080*****111',
'data_plan' => 1,
'bypass' => false,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '@jannah_opt('site_url')/api/data');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$headers = [
"Authorization: Bearer {{ $user->api_token }}",
'Content-Type: application/json'
];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
Expected Response
{
"status": "success",
"message": "Yello! You have gifted 500MB to 23470*****088. Share link https://mtnapp.page.link/myMTNNGApp with 23470*****088 to download the new MyMTN app for exciting offers.",
}