9

我正在使用Authorize.net的客户信息管理器API(CIM)。我的测试用例集中在用户在结帐时给出错误的地址。Authorize.net CIM重复交易窗口

我的应用程序将尝试给每个用户提交表单时创建一个客户档案:

$txrq = new AuthorizeNetCIM; 
$txrsp = $txrq->createCustomerProfileTransaction("AuthCapture", $transaction, 'x_duplicate_window=0'); 

我试过设置传递x_duplicate_window,你可以在上面看到,以“额外选项”,其中,在SDK,是请求的以下部分:

<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions> 

不管我用什么值x_duplicate_window,直到默认时间已过authorize.net总是会返回一个错误。

AuthorizeNet Error: Response Code: 3 Response Subcode: 1 Response Reason Code: 11 Response Reason Text: A duplicate transaction has been submitted. 

我担心如果我们的(潜在的)的一个用户尝试提交了错误的地址,实现他或她的错误,然后同时发生事务超时被用错误的更多的时间约3分钟的欢迎。

回答

9

有一个在Authorize.net SDK代码中的错误:

〜线路360-364在CIM.php's method _setPostString()

if ($this->_extraOptions) { 
    $this->_xml->addChild("extraOptions"); 
    $this->_post_string = str_replace("<extraOptions></extraOptions>",'<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>', $this->_xml->asXML()); 
    $this->_extraOptions = false; 
} 

$this->_xml->addChild("extraOptions");结果中的一个节点不匹配str_replace函数调用:<extraOptions/>

修改str_replace会解决这个问题,它将沿着x_duplicate_window参数传递好:

if ($this->_extraOptions) { 
    $this->_xml->addChild("extraOptions"); 
    $this->_post_string = str_replace("<extraOptions/>",'<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>', $this->_xml->asXML()); 
    $this->_extraOptions = false; 
} 
+8

Authorize.net的API太糟糕了,我的工作很糟糕。 – Acyra 2013-05-05 15:45:30

+2

我必须说,Stripe是我用过的最好的支付处理API。 – Nick 2014-07-16 02:44:22