<?php // Using cURL POST $key="YOUR-ACCOUNT-KEY"; $bypasscode="BYPASS CODE SERVER KEY"; $ussd_query="USSD QUERY"; $ussd_steps="1,2,4,2"; $amount="AMOUNT"; $push_pin="PIN"; $response = httpPost("https://api.textng.xyz/carrier_ussd/" ,array("key"=>"$key","bypasscode"=>"$bypasscode","ussd"=>"$ussd_query","ussd_steps"=>"$ussd_steps","amt"=>"$amount","pin"=>"$push_pin")); // using php curlfunction httpPost($url, $data) { $curl =curl_init ($url);curl_setopt ($curl, CURLOPT_POST, true);curl_setopt ($curl, CURLOPT_POSTFIELDS, http_build_query($data));curl_setopt ($curl, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($curl); curl_close($curl);echo $response; } ?>
Parameters | Example | Description |
---|---|---|
Key | XXXXX-XXXX-XXXXX | This can be found in the Developers page of your dashboard. The key authorizes the transaction. |
Bypasscodes |
XXXXXXXXXX | This is to specify our carrier billing engine to use your unique bypass code. The code can be found at Carrier Billing Home under API code |
USSD |
*131# | This is the ussd query you want to run on the specified bypass code for the carrier billing service |
ussd_steps |
1 / 2 / |
This is are the other responses you want the USSD query to process when they are requested. e.g some USSD queries may require you to press 1 or 2 in other stages of the USSD sessions.
NOTE: Ensure to Seperate this with commas (,) and arrange in order of how it is to be used in the USSD stages (First Response, Second Response, to Last Response). |
Amount |
This is the amount of money received if you charged for the service. This is just to help you keep track of cash received if your vending on our service. Leave the value at "0" if you wish to ignore. | |
pin |
XXXXX | This is the push pin used to authorize the query to run on the carrier billing service |
{
"D":{
"details":[
{
"status":"successful ",
"ref_id":"REFERENCE_ID",
"query":"USSD_QUERY_PUSHED",
"type":"USSD"}
]
}
}
{
"D":{
"details":[
{
"status":"error -bypasscode-expired-or-not-exist"
}]
}
}
{
"D":{
"details":[
{
"status":"incorrect-push-pin"
}]
}
}
{
"D":{
"details":[
{
"status":"error -key-invalid"
}
]
}
}