Redeem already paid for Chimoney programmatically, it is super easy, here is how to it, Chief 😉
var myHeaders = new Headers();
myHeaders.append("X-API-Key", "API_KEY_FROM_DEV_PORTAL");
var raw = "{\n \"chiRef\": \"0khfkmfmkfk\",\n \"countryToSend\": \"Kenya\",\n \"phoneNumber\": \"+254710102720\"\n}";
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://live.chimoney.io/api/v0.1/redeem/airtime", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import requests
url = "https://live.chimoney.io/api/v0.1/redeem/airtime"
payload = "{\n \"chiRef\": \"0khfkmfmkfk\",\n \"countryToSend\": \"Kenya\",\n \"phoneNumber\": \"+254710102720\"\n}"
headers = {
'X-API-Key': 'API_KEY_FROM_DEV_PORTAL'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://live.chimoney.io/api/v0.1/redeem/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 =>'{
"chiRef": "0khfkmfmkfk",
"countryToSend": "Kenya",
"phoneNumber": "+254710102720"
}',
CURLOPT_HTTPHEADER => array(
'X-API-Key: API_KEY_FROM_DEV_PORTAL'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;