Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Phantom Authorize.net


davedesign

Recommended Posts

I have everything set up correctly in my payment module. (and I believe in Authorize.net). I can go thru the checkout process with a valid or invalid card number. Items still remain in cart after checkout. Nothing happens in Authorize.net. Both cart and Authorize are in Live Mode. I get to the checkout_success.php page with this address at the top:

 

https://secure.authorize.net/gateway/transact.dll

 

Therefore I know it is at least going to Authorize.net.

 

Please help.

 

Distressed Dave

Link to comment
Share on other sites

davedesign: if you end up solving your problem, please post back as I don't think anyone else is going to enlighten us on this issue. I've been looking through files now for over twelve hours and still can't find anything out of the ordinary that looks wrong or seems to be missing. I promise I'll do the same.

Link to comment
Share on other sites

In /catalog/includes/modules/payment/authorizenet.php change:

 

// Code 3 is an error - but anything else is an error too (IMHO)

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_AUTHORIZENET_TEXT_ERROR_MESSAGE), 'SSL', true, false));

 

To:

 

// Code 3 is an error - but anything else is an error too (IMHO)

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_AUTHORIZENET_TEXT_ERROR_MESSAGE . ' ' . $HTTP_POST_VARS['x_response_reason_code']), 'SSL', true, false));

 

 

This will append the response reason code to the end of the error message displayed at the top of the checkout page.

 

Overview

--------

 

Quick but useful modification to the standard AuthorizeNet SIM module

to email information AuthorizeNet returns to the shop owner on an

error.

 

Please consult the AuthorizeNet SIM Implementation guide for an

explanation of errors (http://www.authorizenet.com/support/guides.php).

 

Disclaimer

----------

 

This code has been tested with osCommerce 2.2 MS2.

BACKUP YOUR FILES BEFORE INSTALLING.

Use this code at your own risk. No warranty offered.

Let us know if you find any bugs.

 

Installation Instructions

-------------------------

 

Scroll down to the before_process method (line 250 in my version).

 

Replace:

 

function before_process() {

global $HTTP_POST_VARS;

 

if ($HTTP_POST_VARS['x_response_code'] == '1') return;

if ($HTTP_POST_VARS['x_response_code'] == '2') {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_AUTHORIZENET_TEXT_DECLINED_MESSAGE), 'SSL', true, false));

}

// Code 3 is an error - but anything else is an error too (IMHO)

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_AUTHORIZENET_TEXT_ERROR_MESSAGE), 'SSL', true, false));

}

 

with ...

 

function before_process() {

global $HTTP_POST_VARS, $HTTP_SESSION_VARS;

 

if ($HTTP_POST_VARS['x_response_code'] == '1') return;

 

//debug code for failed responses

$authorizenet_warning_body = "Message sent at ".date("D M j G:i:s T Y")."

Customer ID: ".tep_db_prepare_input($HTTP_SESSION_VARS['customer_id'])."

x_response_code:" . tep_db_prepare_input($HTTP_POST_VARS['x_response_code']) . "

x_response_reason_code:" . tep_db_prepare_input($HTTP_POST_VARS['x_response_reason_code']) . "

x_response_reason_text:" . tep_db_prepare_input($HTTP_POST_VARS['x_response_reason_text']) . "

x_avs_code:" . tep_db_prepare_input($HTTP_POST_VARS['x_avs_code']);

tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, "ALERT: AuthorizeNet Error Message Returned", $authorizenet_warning_body, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

 

if ($HTTP_POST_VARS['x_response_code'] == '2') {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_AUTHORIZENET_TEXT_DECLINED_MESSAGE), 'SSL', true, false));

}

// Code 3 is an error - but anything else is an error too (IMHO)

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_AUTHORIZENET_TEXT_ERROR_MESSAGE), 'SSL', true, false));

}

Link to comment
Share on other sites

it works on mine, if you want to play with my test / development site, where you can put your email address and your authorizenet info in there, email me and i will send u instructions. the code works great there, here is an example email i get back from authorizenet:

 

 

Message sent at Thu Feb 5 8:32:41 PST 2004

Customer ID: 2

x_response_code:3

x_response_reason_code:103

x_response_reason_text:This transaction cannot be accepted.

x_avs_code:P

Link to comment
Share on other sites

I noticed while debugging something similiar that depending on what contrib you are using for authorizenet, in authorizenet_direct it may use the variable gobal $response and in authorizenet.php it was using $HTTP_POST_VARS type variables. For example $HTTP_POST_VARS['x_response_code'] == '1'. I was getting a good return from authorize net but for some reason these HTTP_POST_VARS variables are empty. I changed the code back to use $response like in osc 1.2 and it worked again??? Just something to check.

 

I do love the email idea if I could just figure out what's up with these HTTP_POST_VARS variables.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...