cancel
Showing results for 
Search instead for 
Did you mean: 

Could the "response_code" be sent more than once on the odd occassion?

I've got a system set up that's working very well for the most part. However, I've got an intermittent bug that's driving me crazy. After everything is correctly processed and the responce code is sent back to the client's site, a response email is send to relevant parties:

 

if ($_GET['response_code'] == 1)
{

    Response Email Sending Code and other stuff Here

}

 

Works great and I've had few problems - BUT - on the odd occassion the system will suddently spit out multiple responses, as if the responce from authorize.net was received multiple times. After almost 100 payments going through in the past two weeks, I got one response email 20 times earlier this morning (all within less than 60 seconds of each other) - all with the same exact transaction ID. In the past month, maybe 2 or 3 other responses were sent in multiples with the same transaction ID for each multiple.

 

Is it possible the authorize.net server is sending the payment response more than once?
The payee can submit the payment form ONLY once, as the "submit" button is disabled after the first submit. Even if that wasn't working, I don't see somebody sitting there hitting "submit" 20 times in a row.

 

Suggestions? Ideas?

LesMizzell
Member
3 REPLIES 3

You don't mention which API you are using, so I can't give you a simple answer here.  Assuming that you are using AIM or one of our XML APIs, then I can say that this is not possible.  For any of those APIs, the response is provided to you within the same connection that you sent the transaction to us.  This completes the transaction and the connection is closed before you parse the response, this would mean it is impossible to receive the response again unless your system opens a new connection.

 

If you are using SIM or DPM, then the transaction response is sent asynchronously from the transaction submission.  In this case, it is theoretically possible that Authorize.Net could be sending duplicate responses, but this is not something that I have ever heard reported. Can you confirm the API that you are using and whether or not the entire response is identical?

Trevor
Administrator Administrator
Administrator

I'm using a direct post method.

 

From what I can determine, the responses are absolutely identical, but I think I need to add a routine to do email a complete dump of the response to myself to be sure.

 

It's intermittent. I'm currently copying myself on the "paid" response emails that get sent - and 20 or 30 can go through with no duplicates being sent, then all of a sudden one of them - with no special difference from the others - will get sent multiple times.

 

The emails are sent ONLY once the transaction response is received. Other than someone sitting there and resubmitting the form multiple times (and I've code in place to try and prevent that), I can't see how/why this would be happening.

 

I can think of a number of ways to stop this from happening completely, but I want to understand why it's happening first.

 

Pretty standard code:

 

<?php require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK

$redirect_url = "https://www.mysite/responsepage.php";
$api_login_id = my login here';
$md5_setting = "my md5 here"; // Your MD5 Setting
$response = new AuthorizeNetSIM($api_login_id, $md5_setting);
if ($response->isAuthorizeNet())
{
if ($response->approved)
 {
  $enrID = $_GET['enrid'];
  $redirect_url .= '?enrID='.$enrID.'&response_code=1&transaction_id=' .$response->transaction_id;
}
else
{
    $redirect_url .= '?response_code='.$response->response_code .'&response_reason_text=' . $response->response_reason_text;
}

echo AuthorizeNetDPM::getRelayResponseSnippet($redirect_url);
}
else
{
echo "Error. Check your MD5 Setting.";
}?>

 

The response coming back to me is like:

https://mysite.com/order_receipt.php?enrID=3338&response_code=1&transaction_id=4152284647

 

And on the response page I check the reponse code and if approved, send the email:

 

if ($_GET['response_code'] == 1)
{  // update database order status and send email code here....

 

That's it. Pretty simple.

The only thing I can think is to recommend that you look into your email server and see if they might be being duplicated there.  I haven't seen any reports of duplicating transaction results and have a hard time believing that this is something that would happen without causing errors on our side.