这是我与 DCC 一起使用的完整源代码,我用实际值替换了 Mercerid 和 account
$merchantid = "商人"; $secret = "秘密"; $account = '帐户';
这就是我创建哈希的方式
$tmp = "$timestamp.$merchantid.$orderid.$amountinCents.$currency.$cardnumber";
$md5hash = md5($tmp);
$tmp = "$md5hash.$secret";
$md5hash = md5($tmp);
下面是xml发送代码
$xml = "<request type='auth' timestamp='$timestamp'>
<merchantid>$merchantid</merchantid>
<account>$account</account>
<orderid>$orderid</orderid>
<amount currency='$currency'>$amountinCents</amount>
<DCC_ENABLE>1</DCC_ENABLE>
<card>
<number>$cardnumber</number>
<expdate>$expdate</expdate>
<type>$cardtype</type>
<chname>$cardname</chname>
<cvn>
<number>$cvvno</number>
<presind>1</presind>
</cvn>
</card>
<dccinfo>
<ccp>euroconex</ccp>
<type>1</type>
<ratetype>S</ratetype>
<amount currency='$currency'>$amountinCents</amount>
</dccinfo>
<autosettle flag='1'/>
<md5hash>$md5hash</md5hash>
<tssinfo>
<address type=\"billing\">
<country>ie</country>
</address>
</tssinfo>
</request>";
// Send the request array to Realex Payments
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.realexpayments.com/epage-remote.cgi");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "payandshop.com php version 0.9");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); //This should always be set to 'TRUE' when in production to ensure the SSL is enabled.
$response = curl_exec ($ch);
curl_close ($ch);
$parseXML = simplexml_load_string($response);
echo "<pre>";print_r($parseXML);die();
它返回“320 发生内部错误”。消息我不确定我做错了什么我想添加 DCC 设施。