Authorize.NET timeout when creating a subscription
Posted on 2014-04-28
We created a payment process using Authorize.NET integration method. We downloaded the PHP library from authorize.net to handle passing transactions and receiving errors/transaction codes.
The process is two fold: create a direct sale transaction for the initial month, then create a recurring subscription for each month following. We were instructed to do it this way by Authorize.net instead of just creating a subscription that starts immediately because subscriptions were not processed immediately on their end, but instead many hours later. What we found was that if the card info was bad (address, etc), we would not find out right away (subscription is created and not processed for awhile, even if set to start today), which in the case of users subscribing online is a problem. We were advised to create an initial transaction for the first month to get immediate verification the transaction will go through, and then create a subscription for subsequent months.
Normally, there is no problem. However, every once in a while, the subscription fails, even though there is no problem with the card. The direct sale always goes through, then the system follows this up by creating a subscription and there is no response from Authorize.net. I have tweaked the system to run the subscription code in a loop for up to 25 attempts to create a subscription, but the subscription always fails. We then login manually to the authorize.net site and create the subscription ourselves, without any issue.
Originally this problem occurred when we processed several transactions quickly, but lately it happens randomly when no transaction has been processed for an entire day. However, we always process the direct sale and then immediately after create the subscription. So far authorize.net has no solution for us as they claim in these instances that no request to create a subscription is coming through.
I have logs generated by the system showing the creation of the subscription request and attempting to pass it to authorize.net, the requests are the same when everything works and when the subscription request fails.
I am currently thinking that the creation of the direct sale immediately followed by the subscription could be the problem. I know there are checks in place to prevent duplicate transactions, there may be checks against many transactions in sequence at once. In our case, we're doing a direct sale and as quickly as the server can process, another transaction to create the subscription. Perhaps a block on their end is preventing the subsequent subscription. That is why I changed the code to attempt for up to 25 times to create the subscription, but that isn't helping. I can change the code to wait a period of time in between attempts, but we do no want users waiting long periods of time to get their successful confirmation. Also it would be good to know that this is the problem before any further changes are introduced.
Any ideas on what can be going wrong, what we can show to authorize.net to get them to resolve the problem? It's a hindrance to the automation of our subscription system. If there is something amiss with the system on our end, I would like to get it resolved.
Thank you for any help you can provide.