Authorize.net,收取信用卡请求会在提交重复交易时出错

时间:2016-06-10 08:46:22

标签: xml authorize.net

我是Authorize.Net的新手,我正在实施Authorize.Net PHP SDK来实现它。我正在尝试从信用卡中收取费用,但它的错误是:

  

"已提交重复交易"

我阅读了几篇文章,参考:https://community.developer.authorize.net/t5/Integration-and-Testing/Prevent-Duplicate-Transactions/td-p/20417

解决方案提到将 x_duplicate_window =(您自己选择的,最多28800秒)添加到您的脚本中。 所以我把它添加如下:

<createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
    <merchantAuthentication>
        <name>
            <![CDATA[API_LOGIN_ID]]>
        </name>
        <transactionKey>
            <![CDATA[API_TRANSACTION_KEY]]>
        </transactionKey>
    </merchantAuthentication>
    <refId>
        <![CDATA[ref1465541052]]>
    </refId>
    <transactionRequest>
        <transactionType>
            <![CDATA[authCaptureTransaction]]>
        </transactionType>
        <amount>1</amount>
        <payment>
            <creditCard>
                <cardNumber>
                    <![CDATA[4111111111111111]]>
                </cardNumber>
                <expirationDate>
                    <![CDATA[1233]]>
                </expirationDate>
            </creditCard>
        </payment>
        <order>
            <description>
                <![CDATA[DESCRIPTION]]>
            </description>
        </order>
    </transactionRequest>
    <extraOptions><![CDATA[x_duplicate_window=0]]></extraOptions>
</createTransactionRequest>

但是它会抛出错误

  

E00003:元素&#39; createTransactionRequest&#39;在命名空间&#39; AnetApi / xml / v1 / schema / AnetApiSchema.xsd&#39;有无效的子元素&#39; extraOptions&#39; in namespace&#39; AnetApi / xml / v1 / schema / AnetApiSchema.xsd&#39;。

我无法在我的脚本中添加 x_duplicate_window 。 这是防止重复交易错误的正确方法

  

注意:我在沙盒环境和LIVE模式下工作

请帮忙。

1 个答案:

答案 0 :(得分:3)

您需要使用<transactionSettings>元素添加此设置:

<createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
    <merchantAuthentication>
        <name>
            <![CDATA[API_LOGIN_ID]]>
        </name>
        <transactionKey>
            <![CDATA[API_TRANSACTION_KEY]]>
        </transactionKey>
    </merchantAuthentication>
    <refId>
        <![CDATA[ref1465541052]]>
    </refId>
    <transactionRequest>
        <transactionType>
            <![CDATA[authCaptureTransaction]]>
        </transactionType>
        <amount>1</amount>
        <payment>
            <creditCard>
                <cardNumber>
                    <![CDATA[4111111111111111]]>
                </cardNumber>
                <expirationDate>
                    <![CDATA[1233]]>
                </expirationDate>
            </creditCard>
        </payment>
        <order>
            <description>
                <![CDATA[DESCRIPTION]]>
            </description>
        </order>
        <transactionSettings>
            <setting>
                <settingName>duplicateWindow</settingName>
                <settingValue>0</settingValue>
            </setting>
        </transactionSettings>
    </transactionRequest>
</createTransactionRequest>