· 6 years ago · Mar 14, 2019, 04:50 AM
1<?php
2
3$secretKey = ''; // Your secret key here
4$name = urlencode($_GET['name']);
5$email = urlencode($_GET['email']);
6$amount = urlencode($_GET['amount']);
7$txnStatus = urlencode($_GET['txn_status']);
8$orderId = urlencode($_GET['order_id']);
9$txnRef = urlencode($_GET['txn_ref']);
10$txnMsg = urlencode($_GET['txn_msg']);
11
12// Based on your previous history, we found that you put the return URL parameter as below
13// ?amount_paid=[AMOUNT]&status_id=[TXN_STATUS]&order_id=[ORDER_ID]&transaction_id=[TXN_REF]&msg=[MSG]&hash=[HASH]
14
15# so, this is how you should hash, to get the hash value
16# if you want to have different url params, leave the [HASH] placeholder as is
17$returnURLParamsresult = "$secretKey?amount_paid=$amount&status_id=$txnStatus&order_id=$orderId&transaction_id=$txnRef&msg=$txnMsg&hash=[HASH]";
18$hash_verify = md5($returnURLParamsresult);
19
20echo 'Return URL Param Result: ' . $returnURLParamsresult . '<br><br>';
21echo 'Hash verify: ' . $hash_verify . '<br><br>';
22if ($hash_verify == $_GET['hash']) {
23 echo 'Hash verified...';
24} else {
25 echo 'Invalid hash';
26}