Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Parsing Authorize.net AIM Response


jadamson

Recommended Posts

This Thread explains how to parse the $response variable coming from Authorize.net in Test mode. I was getting the "There was an error processing your credit card ():" so I came up with this little tool for debugging and it only take about five minutes.

 

 

Find in authorize_direct.php. It is the last line in file.

$response = split(",", $authorize);

 

and paste the following code under it.

 ? for ($i=0, $n=sizeof($response); $i<$n; $i++) {
? ? ? $log = fopen("trans.log", "a");
? ? ? fwrite($log, "Position ".($i + 1)." ".$response[$i]."\n");
? ? ? fclose($log);
? }

 

Create "trans.log" file, and place it in the catalog folder. Set trans.log chmod 777. Perform a transaction. If cURL is working properly, you will have data in your trans.log file. If not, cURL is not working. The trans.log will contain read response codes, response reason codes, and response reason text as it is stated in the AIM Implementation Guide here:

 

http://www.authorizenet.com/support/AIM_guide.pdf

 

Refer to the "Fields in the Gateway Response" in the Aim Implemetation Guide. These "Position in Response" fields are in the "trans.log". Then cross reference these codes with the "Response Code Details" also listed in the AIM Guide.

 

Example:

 

The Position values in my log file were:

  • Position 1 3
    Position 2 1
    Position 3 103
    Position 4 This transaction cannot be accepted.
    Position 5
    Position 6 P
    Position 7 0
    Position 8 103
    Position 9 103
    Position 10 14.00

and so on....

 

What it means:

  • Position 1 3 - Position 1 is your "Response code".
    Position 2 1 - A code used by the system for internal transaction tracking.
    Position 3 103 - Position 3 is a "Response Reason Code".

Take Notice of Position1 and Position3. In the Aim Guide under "Response Reason Codes & Response Reason Text", look up the Position 1 value ("Response Code") where Position 3 ("Response Reason Code") is 103.

  • The error is: "A valid fingerprint, transaction key, or password is required for this transaction."

So there you have it. Now you can find out if cURL is working and at the same time evaluate the Authorize.net Response.

 

One other helpful hint. If you are using a "Transaction Key" use the "x_Trans_Key" variable to pass it to Authorize.net. If you are using your Gateway Password, use the "x_password" variable. You only need one or the other. This was confusing to me. I was creating a "Transaction Key" in the Gateway but using x_Trans_Key = "My Password" in the script and that was causing problems. I spoke with Authorize.net and they said they are not the same.

 

Hope this is helpful.

 

Jeff

Edited by jadamson
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...