I'm working with Authorize.net's Customer Information Manager API (CIM). My test case is centered around a user giving the wrong address during checkout.
My application will attempt to create a customer profile each time the user submits the form:
$txrq = new AuthorizeNetCIM;
$txrsp = $txrq->createCustomerProfileTransaction("AuthCapture", $transaction, 'x_duplicate_window=0');
I've tried setting passing x_duplicate_window
as you can see above to "Extra Options," which, in the SDK, is the following part of the request:
<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>
No matter what value I use for x_duplicate_window, authorize.net will always return an error until the default time has passed.
AuthorizeNet Error: Response Code: 3 Response Subcode: 1 Response Reason Code: 11 Response Reason Text: A duplicate transaction has been submitted.
I worry if one of our (potential) users tries to submit the wrong address, realizes his or her error, and then gets greeted with 3 more additional minutes of errors while the transaction timeout occurs.
There is an error in the Authorize.net SDK code:
~Line 360-364 in 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");
results in a node that does not match the str_replace call: <extraOptions/>
Modifying the str_replace will remedy this, which will pass along the x_duplicate_window parameter just fine:
if ($this->_extraOptions) {
$this->_xml->addChild("extraOptions");
$this->_post_string = str_replace("<extraOptions/>",'<extraOptions><![CDATA[' . $this->_extraOptions . ']]></extraOptions>', $this->_xml->asXML());
$this->_extraOptions = false;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With