Authorize.net CIM重复事务窗口

Nic*_*ick 9 php credit-card authorize.net payment-gateway payment-processing

我正在使用Authorize.net的Customer Information Manager API(CIM).我的测试用例以用户在结账时给出错误的地址为中心.

每次用户提交表单时,我的应用程序都会尝试创建客户配置文件:

$txrq = new AuthorizeNetCIM;
$txrsp = $txrq->createCustomerProfileTransaction("AuthCapture", $transaction, 'x_duplicate_window=0');
Run Code Online (Sandbox Code Playgroud)

我已经尝试过x_duplicate_window如上所述设置传递给"额外选项",在SDK中,它是请求的以下部分:

<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>
Run Code Online (Sandbox Code Playgroud)

无论我为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.
Run Code Online (Sandbox Code Playgroud)

我担心,如果我们的(潜在)用户之一尝试提交错误的地址,意识到他或她的错误,那么在事务超时发生时会再遇到3分钟的错误.

Nic*_*ick 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;
}
Run Code Online (Sandbox Code Playgroud)

$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;
}
Run Code Online (Sandbox Code Playgroud)

  • Authorize.net的API非常糟糕,我在使用它时遇到了悲惨的经历. (9认同)
  • 我不得不说,Stripe一直是我用过的最好的支付处理API. (2认同)