php - Authorize.net CIM 重复交易窗口

标签 php payment-gateway credit-card authorize.net payment-processing

我正在使用 Authorize.net 的客户信息管理器 API (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 分钟的额外错误。

最佳答案

Authorize.net SDK代码有错误:

~CIM.php's method _setPostString() 中的第 360-364 行

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;
}

关于php - Authorize.net CIM 重复交易窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11498225/

相关文章:

android - authorize.net 支付网关集成?

kotlin - 我们无法完成此操作。尝试其他付款方式或联系我们。 [OR_CCREU_02]

testing - 生成用于测试的有效信用卡 Track2 数据

php - 简单的 MySQL 查询将不起作用

php - ZF3 多数据库适配器

android - Android 中的 PayuMoney 集成 : Some error occured! 再试一次

c# - CreditCardAttribute 使用哪种算法进行信用卡号格式验证

credit-card - card.io 可以识别哪些卡类型? card.io 是否支持识别商户卡?

php - 多次mysql查询导致返回null

javascript - 我怎样才能在同一个函数中收到多个 ajax 响应