Airtime Purchase
Purchase Airtime
post
{{base_url}}/airtime
Airtime
Take a look at how you might do this:
cURL
NodeJs
PHP - cURL
Python
Dart
curl --location --request POST 'https://api.1app.online/v1/airtime' \
--header 'Authorization: Bearer SECRET_KEY' \
--form 'phoneno="07012345678"' \
--form 'network_id="2"' \
--form 'reference="O4I3U8SRNYOIYT"' \
--form 'amount="5000"'
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.1app.online/v1/airtime',
'headers': {
'Authorization': 'Bearer SECRET_KEY'
},
formData: {
'phoneno': '07012345678',
'network_id': '2',
'reference': 'O4I3U8SRNYOIYT',
'amount': '5000'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.1app.online/v1/airtime',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('phoneno' => '07012345678','network_id' => '2','reference' => 'O4I3U8SRNYOIYT','amount' => '5000'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer SECRET_KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
url = "https://api.1app.online/v1/airtime"
payload={'phoneno': '07012345678',
'network_id': '2',
'reference': 'O4I3U8SRNYOIYT',
'amount': '5000'}
files=[
]
headers = {
'Authorization': 'Bearer SECRET_KEY'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
var headers = {
'Authorization': 'Bearer SECRET_KEY'
};
var request = http.MultipartRequest('POST', Uri.parse('https://api.1app.online/v1/airtime'));
request.fields.addAll({
'phoneno': '07012345678',
'network_id': '2',
'reference': 'O4I3U8SRNYOIYT',
'amount': '5000'
});
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
}
else {
print(response.reasonPhrase);
}

Sample Response

{
"status": true,
"message": "Success",
"txref": "API665023309a400",
"charged": 4900.5,
"newbal": 570004.3
}
Copy link
On this page
post
Airtime
Sample Response