我正在使用 2-Party 集成模型进行 MIGS 与 php 的集成。我已经浏览了一些在线下载的好 pdf,除了给出如何完成集成的草图之外,没有人用代码解释集成从而使初学者开发人员很难遵循或理解..
这是我的表格,它从客户那里收集信用卡详细信息以及其他账单信息:
<form action="" method="post">
<table>
<tr>
<td>Cardholder's First Name:</td>
<td><input type="text" name="First_Name"></td>
</tr><tr>
<td>Cardholder's Last Name:</td>
<td><input type="text" name="Last_Name"></td>
</tr><tr>
<td>Credit Card Number:</td>
<td><input type="text" name="Card_Num"></td>
</tr><tr>
<td colspan="2" align="center">
<small>Please enter the expiration date as follows:
two digits of month and two digits of year.
For instance, January 2008 has to be entered as 0108:</small></td>
</tr><tr>
<td>Exp. date (mmyy):</td>
<td><input type="text" name="Exp_Date" maxlength="4"></td>
</tr><tr>
<td colspan="2" align="center">
<small>The Card Verification Code (Card ID or CVV2)
is required for American Express,Visa and MasterCard.
Please enter: for American Express - 4 digits on front of card;
for Visa and Mastercard - last 3 digits on back of card:</small>
</td>
</tr><tr>
<td>Card Number:</td>
<td><input type="text" name="Card_Code"></td>
</tr><tr>
<td colspan="2" align="center"><small>
Please enter the address at which the credit card bills are received:
</small></td>
</tr><tr>
<td>Street Address:</td>
<td><input type="text" name="Address"></td>
</tr><tr>
<td>City:</td>
<td><input type="text" name="City"></td>
</tr><tr>
<td>State/Province:</td>
<td><input type="text" name="State"></td>
</tr><tr>
<td>Zip/Postal Code:</td>
<td><input type="text" name="Zip"></td>
</tr><tr>
<td>Country:</td>
<td><input type="text" name="Country"></td>
</tr><tr>
<td colspan="2" align="center">
<input type="submit" value="Submit payment">
</td>
</tr>
</table>
</form>
这是php集成代码:
$accessCode = "";//value from migs payment gateway
$merchantId = "";//value from migs payment gateway
$amount = 1000;
$unique_id = rand(999999,8988888888);//this is a sample random no
$order = rand(10,100);
$testarr = array(
"vpc_Amount" => $amount*100,//Final price should be multifly by 100
"vpc_Currency" => 'KES',
"vpc_AccessCode" => $accessCode,//Put your access code here
"vpc_Command"=> "pay",
"vpc_Locale"=> "en",
"vpc_MerchTxnRef"=> $unique_id , //This should be something unique number, i have used the session id for this
"vpc_Merchant"=> $merchantId,//Add your merchant number here
"vpc_OrderInfo"=> $order,//this also better to be a unique number
"vpc_ReturnURL"=> "http:/mydomain/mastercard/success.php",
"vpc_Version"=> "1");
ksort($testarr);
$SECURE_SECRET = ""; //value from migs payment gateway
$securehash = $SECURE_SECRET;
$url = "";
foreach ($testarr as $key => $value)
{
$securehash .= $value;
$url .= $key."=".urlencode($value)."&";
}
$securehash = md5($securehash);//Encoding
$url .= "vpc_SecureHash=".$securehash;
header("location:https://migs.mastercard.com.au/vpcpay?$url");
然后我对我的返回 url 进行转储var_dump($_GET); 它返回以下内容:
mydomain/mastercard/success.php?vpc_Amount=100000&vpc_BatchNo=0&vpc_Command=pay&vpc_Locale=en&vpc_MerchTxnRef=5204024700&vpc_Merchant=$merchantId&vpc_Message=Merchant+[$merchantId]+does+not+exist&vpc_OrderInfo=97&vpc_TransactionNo=0&vpc_TxnResponseCode=7&vpc_Version=1
它返回一条消息说商家不存在..这是我遇到的问题之一。
所以把我的问题编号:
我在表单中输入哪个 url 作为我的“操作”,在用户输入他们的详细信息后,他们的详细信息由支付服务器处理,我如何将表单与支付服务器集成?
为什么我会收到“商家不存在”的回复?