/*
Note:The below code is used to grab the fields Realex Payments POSTs back
to this script after a transaction has been processed. Realex Payments need
to know the full URL of this script in order to POST the data back to this
script. Please inform Realex Payments of this URL if they do not have it
already.
Look at the Realex Documentation to view all hidden fields Realex POSTs back
for a card transaction.
*/
$timestamp = $_POST['TIMESTAMP'];
$result = $_POST['RESULT'];
$orderid = $_POST['ORDER_ID'];
$message = $_POST['MESSAGE'];
$authcode = $_POST['AUTHCODE'];
$pasref = $_POST['PASREF'];
$realexsha1 = $_POST['SHA1HASH'];
$ptype = $_POST['ptype'];
/*
If you are enabled for DCC, these additional fields will also be posted to your response script
$merchantamount = $_POST['DCCAUTHMERCHANTAMOUNT'];
$merchantcurrency = $_POST['DCCAUTHMERCHANTCURRENCY'];
$cardholderamount = $_POST['DCCAUTHCARDHOLDERAMOUNT'];
$cardholdercurrency = $_POST['DCCAUTHCARDHOLDERCURRENCY'];
$cardholderrate = $_POST['DCCAUTHRATE'];
$dccrate = $_POST['DCCAUTHRATE'];
$dccchoice = $_POST['DCCCHOICE'];
*/
// Replace these with the values you receive from Realex Payments.If you have not yet received these values please contact Realex Payments.
$merchantid = "jficmi";
$secret = "kdbTh7ipRa";
// Below is the code for creating the digital signature using the SHA1 algorithm provided by PHP
// This digital siganture should correspond to the
// one Realex Payments POSTs back to this script and can therefore be used to verify the message Realex sends back.
$tmp = "$timestamp.$merchantid.$orderid.$result.$message.$pasref.$authcode";
$sha1hash = sha1($tmp);
$tmp = "$sha1hash.$secret";
$sha1hash = sha1($tmp);
//Check to see if hashes match or not
if ($sha1hash != $realexsha1) {
echo "Hashes don't match - response not authenticated!";
}
/*
You can send yourself an email or send the customer an email or update a database or whatever you want to do here.
The next part is important to understand. The result field sent back to this
response script will indicate whether the transaction was successful or not.
The result 00 indicates it was successful while anything else indicates it failed.
Refer to the Realex Payments documentation to get a full list to response codes.
IMPORTANT: Whatever this response script prints is grabbed by Realex Payments
and placed in the template again. It is placed wherever the
Thank you for trying to register for the JFICMI Fellowship exam.
Unfortunately, your online payment has not been accepted.
Please ensure all the data you have entered is correct.
Please contact your financial institution before submitting a further application. Your application has not been processed.