我需要有人帮我将MIG支付网关集成到我的网站,我从银行收到3个文件
vpc_php_serverhost_do.php
vpc_php_serverhost_dr.php
vpc_php_serverhost.html
这些文件的使用方法以及如何使用它们,以及我如何生成URL,请有人帮忙并详细说明要执行的步骤。
由于
答案 0 :(得分:0)
这是我的MIGS PHP
<?
$SECURE_SECRET = "YOU_GET_THIS_FROM_THE_BANK";
$accessCode = 'YOU_GET_THIS_FROM_THE_BANK';
$merchantId = 'YOU_GET_THIS_FROM_THE_BANK';
$merchinvno = GENERATED_ID_OF_PURCHASE; //example 123456
$amount = 20;
$vpcinfo = 'Purchase of Item 1';
$postdata = array(
"vpc_AccessCode" => $accessCode,
"vpc_Amount" => ($amount*100),
"vpc_Command" => 'pay',
"vpc_Locale" => 'en',
"vpc_MerchTxnRef" => $merchinvno,
"vpc_Merchant" => $merchantId,
"vpc_OrderInfo" => $vpcinfo,
"vpc_ReturnURL" => "https://www.YOUR_DOMAIN.com/PAYMENT_RESULT_PAGE.php",
"vpc_Version" => '1');
$vpcURL = 'https://migs.mastercard.com.au/vpcpay?';
$md5Hash = $SECURE_SECRET;
$appendAmp = 0;
foreach ($postdata as $key => $value) {
if (strlen($value) > 0) {
if ($appendAmp == 0) {
$vpcURL .= urlencode($key) . '=' . urlencode($value);
$appendAmp = 1;
} else {
$vpcURL .= '&' . urlencode($key) . "=" . urlencode($value);
}
$md5Hash .= $value;
}
}
if (strlen($SECURE_SECRET) > 0) {
$vpcURL .= "&vpc_SecureHash=" . strtoupper(md5($md5Hash));
}
header("Location: " . $vpcURL)
?>
然后在你的PAYMENT_RESULT_PAGE.php中检查你从银行得到的回复,如果回复= 00,那么付款成功,其他数字表示付款失败,你会在文件中找到相应错误的代码给你
PAYMENT_RESULT_PAGE.php的示例
<?
$response = $_GET['vpc_TxnResponseCode'];
$message = $_GET['vpc_Message'];
if ($response == '00') {
echo 'Payment Successful';
} else {
echo 'Payment Failed: '.$message;
}
?>