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

Sample Response

1
{
2
"status": true,
3
"message": "Success",
4
"txref": "API665023309a400",
5
"charged": 4900.5,
6
"newbal": 570004.3
7
}
Copied!