【问题标题】:Authorize.net CIM Duplicate Transaction WindowAuthorize.net CIM 重复交易窗口
【发布时间】:2012-07-14 22:35:55
【问题描述】:

我正在使用 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 分钟的错误。

【问题讨论】:

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


    【解决方案1】:

    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-&gt;_xml-&gt;addChild("extraOptions"); 导致节点与 str_replace 调用不匹配:&lt;extraOptions/&gt;

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

    【讨论】:

    • Authorize.net 的 API 很糟糕,我使用它的经历很糟糕。
    • 我不得不说,Stripe 是我用过的最好的支付处理 API。
    猜你喜欢
    • 2016-04-17
    • 2012-11-19
    • 2013-07-01
    • 2012-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-06
    • 2011-03-29
    相关资源
    最近更新 更多