我在2checkout上有模拟帐户。我需要通过2checkout接受在线付款。因此,我正在使用模拟帐户测试代码。问题是在模拟账户上我收到消息,订单已成功处理,但是当我使用文档在我方进行验证时,总是失败。

以下是用于在线付款的html代码

 <form action='https://www.2checkout.com/checkout/purchase' method='post'>
    <input type='hidden' name='sid' value='202351337'>
    <input type='hidden' name='quantity' value='1'>
    <input type='hidden' name='product_id' value='1'>
    <input name='submit' type='submit' value='Buy from 2CO' >
    </form>


以下是取自2checkout官方文档的验证码

<?php
print_r($_REQUEST);
$hashSecretWord='james007'; //2Checkout Secret Word
$hashSid=202351337; //2Checkout account number
$hashTotal=100.00; //Sale total to validate against
$hashOrder=1; //2Checkout Order Number
$StringToHash = strtoupper(md5($hashSecretWord . $hashSid . $hashOrder . $hashTotal));
echo "<br/> And StringToHash is $StringToHash <br/>";
if ($StringToHash != $_REQUEST['key'])
{
$result = 'Fail - Hash Mismatch';
}
else
{
$result = 'Success - Hash Matched';
}

echo $result;


我总是向失败散列不匹配消息发送消息

最佳答案

你给的$hashOrder=1;

但是订单号1仅适用于演示销售
如果您的发布网址如下所示,则只有$hashOrder=1;可以使用
(https://sandbox.2checkout.com/checkout/purchase'method ='post'>)。

但是您使用的是<form action='https://www.2checkout.com/checkout/purchase' method='post'>。这意味着您的现场销售。
在这种情况下$hashOrder=$_REQUEST['hashOrder'];

希望这对您有用。

关于php - 2模拟账户上的checkout付款验证不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26040043/

10-12 12:46
查看更多