Token Generation
The parameter “token” is generated with the MD5 (Message Digest Algorithm).
To generate token use the apiKey, amount, currency, referenceNo, timestamp and YOUR_SECRET. The parameters will be combined without any character between them (secretKeyapiKeyamountcurrencyreferenceNotimestamp) YOUR_SECRET is the code generated for each merchant. For example; YOUR_SECRET = t5h2po.
<?php
$apiKey = 'YOUR_API_KEY';
$currency = 'EUR';
$amount = 100;
$referenceNo = uniqid('reference_');
$timestamp = time ();
$secretKey = 'YOUR_SECRET_KEY';
$code = '00';
$status = 'APPROVED';
$params = [
'apiKey' => $apiKey ,
'code' => $code ,
'status' => $status ,
'amount' => $amount ,
'currency' => $currency ,
'referenceNo' => $referenceNo ,
'timestamp' => $timestamp
];
function generateToken($request, $secretKey) {
$rawHash = $secretKey . $params['apiKey'] . $params['code'] . $params['status'] . $params['amount'] . $params['currency'] . $params['referenceNo'] . $params['timestamp'];
return md5( $rawHash );
}
Updated 5 months ago