Pay URA
THis is method is used to complete payment to URA
Request Type
POST
General Payload
// Sample PHP pay Load
$live_url = "https://silicon-pay.com/pay_ura";
$test_url = "https://silicon-pay.com/test/pay_ura";
$data_req = [
"prn"=>"This is the PRN provided by URA",
"emailAddress"=>"User Email Address",
"phone"=> "User Phone Number",
"encryption_key"=>"Account Encryption Key",
"amount"=>"Amount to Due Amount got from Query URA PRN info",
"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 PRN
PRN: 2220002408213
Parameter Description
# | Parameter | Description | 1 | PRN | This is the Customer PRN provided bt URA |
---|---|---|
3 | emailAddress | Email Address of the user |
4 | phone | Phone Number of the user |
5 | encryption_key | Account Encryption Key |
6 | amount | Due Amount to pay. This value id got from query URA PRN info |
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 URA transaction accepted."
}
Sample Failure Response
When there is an issue with the network or when something is not right, you shall get a failed notification with a description for the failure
{
"status": 201,
"message": "Pay URA transaction failed.",
"description": "XXXXXX"
}
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':"XXXXX",
'amount':"XXXXX",
'charge':"XXXXXX",
'type'=>"URA",
'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.
}