【问题标题】:realex showing Mandatory Fields missing: [/request/sha1hash]. error messagerealex 显示缺少必填字段:[/request/sha1hash]。错误信息
【发布时间】:2017-10-25 05:36:16
【问题描述】:

这是我与 DCC 一起使用的完整源代码,我用实际值替换了商家 ID 和帐户

$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 设施。

【问题讨论】:

  • 嗨 Paritosh,正如我在回答中提到的,请使用 SHA1 而不是 MD5。此外,此“1”无效,请删除该行。在提交此身份验证之前,我是否也可以再次检查您是否正在处理 DCC 速率查询请求? developer.realexpayments.com/#!/api/dcc/dcc-rateSeán
  • 您好,谢谢,我已经对您在评论中提到的进行了更改。从 xml 文件中删除了“1”并使用 sha1 $tmp = "$timestamp.$merchantid.$orderid.$amountinCents.$currency.$cardnumber"; $sha1Hash = sha1($tmp); $tmp = "$sha1Hash.$secret"; $sha1Hash = sha1($tmp); 并传递 dcc 信息以及 &lt;dccinfo&gt; &lt;ccp&gt;fexco&lt;/ccp&gt; &lt;type&gt;1&lt;/type&gt; &lt;ratetype&gt;S&lt;/ratetype&gt; &lt;amount currency='$currency'&gt;$amountinCents&lt;/amount&gt; &lt;/dccinfo&gt; 但是它仍然向我显示相同的错误消息 [result] => 320 [message] => 发生内部错误。

标签: php realex-payments-api


【解决方案1】:

感谢您的提问。首先,我强烈建议您使用 SHA1 算法而不是 MD5 来散列交易详情。

其次,您没有发布请求 XML,但它必须遵循以下格式:

<?xml version='1.0' encoding='UTF-8'?>
<request type='auth' timestamp='20171025141809'>
<merchantid>Merchant ID</merchantid>
<account>internet</account>
<channel>ECOM</channel>
<orderid>N6qsk4kYRZihmPrTXWYS6g</orderid>
<amount currency='EUR'>1001</amount>
<card>
    <number>4263970000005262</number>
    <expdate>0519</expdate>
    <chname>James Mason</chname>
    <type>VISA</type>
    <cvn>
        <number>123</number>
        <presind>1</presind>
    </cvn>
</card>
<autosettle flag='1'/>
<comments>
    <comment id='1'>Mobile Channel</comment>
    <comment id='2'>Down Payment</comment>
</comments>
<sha1hash>87707637a34ba651b6185718c863abc64b673f20</sha1hash>
</request>

请确保您在请求 XML 中有 sha1hash 元素,并且填充了适当的值。

最好的,

肖恩

Realex 支付

【讨论】:

  • 我已经更新了问题,你可以看看它
  • 您好,感谢您的回复。我的脚本现在工作正常。我只想确认之前的一件事(没有 dcc)我在添加 dcc 功能后得到一个名为“batchid”的参数作为响应,我没有得到任何参考。您能否提供一些详细信息,从响应中删除也是实际需要的。谢谢。
  • 我需要更多信息,例如您使用的请求。对于授权,您将始终收到一个 batchid。对于 DCC Rate Lookup 请求,您不会收到请求,因为不涉及批次。您只需在授权中使用获得的费率。
猜你喜欢
  • 2023-03-22
  • 2022-06-30
  • 1970-01-01
  • 1970-01-01
  • 2011-10-08
  • 1970-01-01
  • 2014-08-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多