Pay UMEME YAKA
Yaka! is the prepayment system from Umeme that allows customers to conveniently manage and control their electricity
This is method is used to complete payment of UMEME YAKA
Request Type
POST
General Payload
// Sample PHP pay Load
$live_url = "https://silicon-pay.com/pay_yaka";
$test_url = "https://silicon-pay.com/test/pay_yaka";
$data_req = [
"account_number"=>"Customer Reference/ Account Number/ Meter Number",
"emailAddress"=>"User Email Address",
"phone"=> "User Phone Number",
"encryption_key"=>"Account Encryption Key",
"amount"=>"Amount to pay",
"call_back"=> "Success callback URL",
"tx_ref"=>"Unique Transaction Reference"
];
// Now Generate the signature.
$secrete_key ="XXXX";
$encryption_key = "XXXXX";
$phone_number = "XXXX";
$msg = hash('sha256',$encryption_key).$phone_number;
$signature = hash_hmac('sha256',$msg, $secrete_key);
$headers = [
"signature:". $signature,
'Content-Type: application/json'
];
$curl = curl_init();
curl_setopt_array($curl, array(
//Use live url ($live_url) when in production.
CURLOPT_URL => $test_url,
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 =>json_encode($data_req),
CURLOPT_HTTPHEADER => $headers,
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Test Meter Number/ Account Number
Meter Number/Account Number: 04245402021
Parameter Description
# | Parameter | Description |
---|---|---|
1 | Area | This is got from the query areas endpoint and selected |
2 | Account Number | This is the Customer Reference/ Account Number/ Meter Number |
3 | emailAddress | Email Address of the user |
4 | phone | Phone Number of the user |
5 | encryption_key | Account Encryption Key |
6 | amount | Amount to pay. |
7 | call_back | URL where a callback IPN shall be sent |
8 | tx_ref | Unique transaction reference |
Success Response
When all the payload parameters are correct
{"
status":200,"message":"Pay UMEME YAKA transaction accepted."
}
Failure Response
When there is an issue with the network or when something is not right, you shall get a failed notification
{
"status":201,"message":"Pay UMEME YAKA transaction failed.",
"description":"XXXXX"
}
CallBack/ IPN Notification
Once the transaction has been succeefully proceessed, An IPN is sent back to your provided call back URL.
{
'code':"200",
'status':'success',
'txRef': "XXXXXX",
'amount':"XXXXXX",
'charge':"XXXXXX",
'yaka_token':"XXXXXXX",
'yaka_units':"XXXXXXXX",
'yaka_message':"XXXXXXXX",
'type'=>"YAKA",
'secure_hash'=>"XXXX"
}
Recieve IPN/Call Back
A secure hash is sent with the call back data. This is to help you confirm that the call back came from us.
// Recieve IPN.
$body = file_get_contents("php://input");
$dataObject = json_decode($body);
$reference = $dataObject->txRef;
$secure_hash = $dataObject->secure_hash;
$secrete_key ="Enter your account Secrete key";
// Generate a secure hash on your end.
$cipher = 'aes-256-ecb';
$generated_hash = openssl_encrypt($reference, $cipher, $secrete_key);
if($generated_hash == $secure_hash){
// The call back came from us.
// Give value to your customers.
}