-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
37 lines (33 loc) · 1.04 KB
/
index.php
File metadata and controls
37 lines (33 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
$secretHash="xxxxxx";
$accessCode='xxxxx';
$merchantId='xxxxx';
$data = array(
"vpc_AccessCode" => $accessCode,
"vpc_Amount" => '100',
"vpc_Command" => 'pay',
"vpc_Locale" => 'en',
"vpc_MerchTxnRef" => "REF_".time(),
"vpc_Merchant" => $merchantId,
"vpc_OrderInfo" => "Order_N_".time(),
"vpc_ReturnURL" => urlencode("yourReturnUrl"),
"vpc_Version" => '1',
'vpc_SecureHashType' => 'SHA256'
);
ksort($data);
$hash = null;
foreach ($data as $k => $v) {
if (in_array($k, array('vpc_SecureHash', 'vpc_SecureHashType'))) {
continue;
}
if ((strlen($v) > 0) && ((substr($k, 0, 4)=="vpc_") || (substr($k, 0, 5) =="user_"))) {
$hash .= $k . "=" . $v . "&";
}
}
$hash = rtrim($hash, "&");
$secureHash = strtoupper(hash_hmac('SHA256', $hash, pack('H*', $secretHash)));
$paraFinale = array_merge($data, array('vpc_SecureHash' => $secureHash));
$actionurl = 'https://migs.mastercard.com.au/vpcpay?'.http_build_query($paraFinale);
//print_r($actionurl);
header("Location:".$actionurl);
?>