cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate Window Parameter

I am using the  the anetAPI from github in PHP.

 

I am trying to set the Duplicate Window Parameter during transaction authorization and during customer profile creation using PHP code.

 

What is the correct synthax to use for both these cases?

 

Thanks.

arthurkhatch
Member
6 REPLIES 6

Hi,

 

For both of those cases, the syntax will be the same. You'll need to create a variable of type "SettingType", then add the SettingName and SettingValue to that variable using the "setSettingName" and "setSettingValue" methods, like so:

 

//add the values for transaction settings
$duplicateWindowSetting = new AnetAPI\SettingType();
$duplicateWindowSetting->setSettingName("duplicateWindow");
$duplicateWindowSetting->setSettingValue("600");

 

Then, add the settings to the TransactionRequestType values that you're building using the "addToTransactionSettings" method:

 

$transactionRequestType->addToTransactionSettings($duplicateWindowSetting);

 

Other transaction settings are set the same way.

 

Let us know if you have any other questions!

 

-Aaron

Aaron
All Star

Hello,

 

Thank you for this detailed explanation. May you suggest the proper way to add the same parameter to the subscription request created by the ARBSubscriptionType class?

Hi @kos

 

I'm not aware of any way to define the duplicateWindow parameter for a create subscription request. In a regular transaction, the duplicateWindow parameter keeps an identical transaction from being approved within the timeframe set by the parameter.

 

I'm not sure that there's a use case for that parameter in the context of a subscription request, since you're the one setting the schedule for the transaction.

 

If I'm misunderstanding your request, please feel free to correct me!

Hi @Aaron,

 

Thanks for quick reply.

 

We use AnetAPI in our application and we give our customers ability to create a subscription plan for the products. We got an issue when the same customer tried to create multiple different subscriptions in a row. Customer used the same billing info (name, credit card, address) and tried to buy different products. After the first subscription was successfull, every next one would get an E00012 error (A duplicate subscription already exists) in response, with message like:


Error Code: E00012. You have submitted a duplicate of Subscription {ID of previous successful subscription}. A duplicate subscription will not be created.

 

We were looking for the solution, and didn't find anything more appropriate
than the Duplicate Transaction Window prevention mechanism. We thought that problem is in 'x_duplicate_window' parameter check, which must be set to 2 minutes by default, as mentioned in support reply here. Each subscription has 'startDate' parameter set to current date. The user was trying to add new subscriptions for an hour and then gave up. We lost those sales.

 

For now this problem was resolved by providing unique Invoice Number parameter in each request.

The ARB system checks a new subscription for duplicates, using these fields:

 

  • subscription.article.merchantID
  • subscription.article.customerInfo.payment.creditCard.cardNumber
  • subscription.article.customerInfo.payment.eCheck.routingNumber
  • subscription.article.customerInfo.payment.eCheck.accountNumber
  • subscription.article.customerInfo.customerID
  • subscription.article.customerInfo.billingInfo.billToAddress.firstName
  • subscription.article.customerInfo.billingInfo.billToAddress.lastName
  • subscription.article.customerInfo.billingInfo.billToAddress.company
  • subscription.article.customerInfo.billingInfo.billToAddress.streetAddress
  • subscription.article.customerInfo.billingInfo.billToAddress.city
  • subscription.article.customerInfo.billingInfo.billToAddress.stateProv
  • subscription.article.customerInfo.billingInfo.billToAddress.zip
  • subscription.orderInfo.amount
  • subscription.orderInfo.invoice
  • subscription.recurrence.startDate
  • subscription.recurrence.interval
  • subscription.recurrence.unit

If all of these fields are duplicated in an existing subscription, E00012 will result. Modifying any of these fields should result in a unique subscription.

 

To help future developers, I've put in a request to update our documentation with these details.

 

Richard

This is an old question but it comes up in google as an answer so I figured I'd supply a link to the answer here. I found this at the location below.

https://community.developer.authorize.net/t5/Integration-and-Testing/C-add-settingType-to-transactio...

 

var settings = new settingType[] { 
           new settingType
           {
               settingName = settingNameEnum.duplicateWindow.ToString(),
               settingValue = "0"
           } 
};
var transactionRequest = new transactionRequestType {
           transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),    // charge the card
           amount = amount,
           payment = paymentType,
           billTo = billingAddress,
           lineItems = lineItems,
           transactionSettings=settings};