Vend Electricity
Make a call to our electricity purchase endpoint to buy electricity
post
{{base_url}}/electricity
Buy Electricity
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/electricity' \
2
--header 'Authorization: Bearer SECREY_KEY' \
3
--form 'meterno="62320094725"' \
4
--form 'metername="BRAHIM MARY OPE"' \
5
--form 'provider="IBADAN"' \
6
--form 'amount="10000"' \
7
--form 'vendtype="PREPAID"'
Copied!
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://api.1app.online/v1/electricity',
5
'headers': {
6
'Authorization': 'Bearer SECREY_KEY'
7
},
8
formData: {
9
'meterno': '62320094725',
10
'metername': 'BRAHIM MARY OPE',
11
'provider': 'IBADAN',
12
'amount': '10000',
13
'vendtype': 'PREPAID'
14
}
15
};
16
request(options, function (error, response) {
17
if (error) throw new Error(error);
18
console.log(response.body);
19
});
20
Copied!
1
$curl = curl_init();
2
3
curl_setopt_array($curl, array(
4
CURLOPT_URL => 'https://api.1app.online/v1/electricity',
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('meterno' => '62320094725','metername' => 'BRAHIM MARY OPE','provider' => 'IBADAN','amount' => '10000','vendtype' => 'PREPAID'),
13
CURLOPT_HTTPHEADER => array(
14
'Authorization: Bearer SECREY_KEY'
15
),
16
));
17
18
$response = curl_exec($curl);
19
20
curl_close($curl);
21
echo $response;
Copied!
1
import requests
2
3
url = "https://api.1app.online/v1/electricity"
4
5
payload={'meterno': '62320094725',
6
'metername': 'BRAHIM MARY OPE',
7
'provider': 'IBADAN',
8
'amount': '10000',
9
'vendtype': 'PREPAID'}
10
files=[
11
12
]
13
headers = {
14
'Authorization': 'Bearer SECREY_KEY'
15
}
16
17
response = requests.request("POST", url, headers=headers, data=payload, files=files)
18
19
print(response.text)
20
Copied!
1
var headers = {
2
'Authorization': 'Bearer SECREY_KEY'
3
};
4
var request = http.MultipartRequest('POST', Uri.parse('https://api.1app.online/v1/electricity'));
5
request.fields.addAll({
6
'meterno': '62320094725',
7
'metername': 'BRAHIM MARY OPE',
8
'provider': 'IBADAN',
9
'amount': '10000',
10
'vendtype': 'PREPAID'
11
});
12
13
request.headers.addAll(headers);
14
15
http.StreamedResponse response = await request.send();
16
17
if (response.statusCode == 200) {
18
print(await response.stream.bytesToString());
19
}
20
else {
21
print(response.reasonPhrase);
22
}
23
Copied!

Sample Response

1
{
2
"status": true,
3
"message": "Success - Bills Payment effected successfully - Token: 0283-6213-2450-8322-0153",
4
"txref": "API2650280812e8401",
5
"charged": 10030,
6
"token": "Bills Payment effected successfully - Token: 0283-6213-2450-8322-0153",
7
"newbal": 300094.79
8
}
Copied!