Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Authorize Net AIM module


Vger

Recommended Posts

It looks like you're missing the text define in the includes/languages/english/modules/payment/ level file.

 

Vger

 

 

you will need to change in includes/languages/english/modules/payment/authorizenet_aim.php

 

 define('MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_ADMIN_TITLE', 'authorizenet_aim')

 

to

 

 define('MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_ADMIN_TITLE', 'Credit Card')

 

Please note that you won't see the changes in your existing orders: the payment method value is inserted in the database "as is" and not indexed as it should be (which would be much more elegant and allow name changes), it will show up in your next orders.

 

BUT BEWARE: changing this line will change the title of the payment method in your admin/ modules list: you won't see Authorizenet AIM anymore, that may confuse you, as you will see several "credit card" options

 

To fix this completely, it would require creting another define line, just to manage the name of the module.

Edited by pixclinic
Link to comment
Share on other sites

Thanks Vger and Hugh,

 

This is what I have in /languages/english/modules/payment/authorizenet_aim.php:

 

define('MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_ADMIN_TITLE', 'Authorize.net AIM'); // Payment option title as displayed in the admin

define('MODULE_PAYMENT_AUTHORIZENET_AIM_TEXT_CATALOG_TITLE', 'Credit Card'); // Payment option title as displayed to the customer

 

The line below calls the payment method displayed in checkout_confirmation.php

 

<?php echo $order->info['payment_method']; ?>

 

Did you change this line?

 

Cheers,

EricK

 

PS: this is not unique to Authorize.net, because if I select PayPal IPN it displays 'paypal_ipn' and Check/Money Order displays 'moneyorder'.

Edited by EricK
Link to comment
Share on other sites

I had this contribution working on my previous shared server. I've now moved to a dedicated server and with the contribution installed get the error:

 

This transaction cannot be accepted. - Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance

 

I've read this whole thread and tried curl fixes, and other suggested fixes and haven't been able to find one that works.

 

I have SSL enabled and curl compiled.

 

Any ideas?

 

Thanks

Ryan

rkoechel2004

Link to comment
Share on other sites

I had this contribution working on my previous shared server. I've now moved to a dedicated server and with the contribution installed get the error:

 

This transaction cannot be accepted. - Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance

 

I've read this whole thread and tried curl fixes, and other suggested fixes and haven't been able to find one that works.

 

I have SSL enabled and curl compiled.

 

Any ideas?

 

Thanks

Ryan

 

the difference between a shared and dedicated server woudl be the configure.php file.

please post your catalog/includes/configure.php (especially the servers and cookies parts

Link to comment
Share on other sites

the difference between a shared and dedicated server woudl be the configure.php file.

please post your catalog/includes/configure.php (especially the servers and cookies parts

 

Here is my config file contents:

 

// * DIR_FS_* = Filesystem directories (local/physical)

// * DIR_WS_* = Webserver directories (virtual/URL)

define('HTTP_SERVER', 'http://www.********.com'); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', 'https://www.******.com'); // eg, https://localhost - should not be empty for productive servers

define('ENABLE_SSL', true); // secure webserver for checkout procedure?

define('HTTP_COOKIE_DOMAIN', 'www.*****.com');

define('HTTPS_COOKIE_DOMAIN', 'www.*****.com');

define('HTTP_COOKIE_PATH', '/');

define('HTTPS_COOKIE_PATH', '/');

define('DIR_WS_HTTP_CATALOG', '/');

define('DIR_WS_HTTPS_CATALOG', '/');

define('DIR_WS_IMAGES', 'images/');

define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

rkoechel2004

Link to comment
Share on other sites

Just ran the following script:

 

<?
function ssl_connect($url,$variables=0,$parse_variables=0,$test=0,$timeout=30,$no_headers=0){
global $SC;
define(UMURL,$url);
define(UMTIMEOUT,$timeout);

// check for presence of CURL
if (!function_exists("curl_init")){
	// only display CURL error message if it hasn't been displayed before
	if (!$SC['no_curl']) print "\n Error: cURL is not enabled on your web server.";
	$SC['no_curl'] = 1;
	return;
}

// if URL has https in it, check for presence of OpenSSL
$ch = curl_init(UMURL);

// set some options for the connection
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch,CURLOPT_TIMEOUT,UMTIMEOUT);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
// This is the line that should fix secure cURL requests. Uncomment this line if secure cURL requests fail
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);


// run the transfer
$result=curl_exec ($ch);
if(curl_errno($ch) > 0) echo "<p style='color: red'><b>cURL ERROR#".curl_errno($ch).": ".curl_error($ch)." at ".__LINE__." in ".__FILE__."</b></p>";
curl_close ($ch);
return $result;
}


print "<html><head><title>CURL Test Page</title></head><body style=\"font-family: verdana, helvetica, tahoma; font-size: 12pt\"><b>cURL Test Page</b><br><br>To test a regular HTTP connection via curl to http://www.ebay.com,
<br>
<a href=\"?method=normal\">click here</a><br><br>
";
print "To test a secure HTTPS (SSL) connection via curl to https://adwords.google.com/select/Login
<br>
<a href=\"?method=secure\">click here</a><br>";


if ($HTTP_GET_VARS['method']) {
print "<br><b>If a page is displayed below, the test worked. Do not worry about broken image tags. As long as you have some output from the page below the test is valid:</b><hr width=\"100%\" height=\"2\"><br><br>";

if ($HTTP_GET_VARS['method'] == "normal") $page = "http://www.ebay.com";
if ($HTTP_GET_VARS['method'] == "secure") $page = "https://adwords.google.com/select/Login";
$page_data = ssl_connect($page);
print $page_data;
}

print "</body></html>";
?>

 

 

and got this response:

 

cURL ERROR#60: error setting certificate verify locations: CAfile: /usr/home/builder/pb_work_dir/psa_aiconfig_8.0.0/psa/lib/dist/share/curl/curl-ca-bundle.crt CApath: none at 28 in /usr/local/psa/home/vhosts/my_site.com/httpdocs/curl.php

 

any ideas?

rkoechel2004

Link to comment
Share on other sites

Here is my config file contents:

 

// * DIR_FS_* = Filesystem directories (local/physical)

// * DIR_WS_* = Webserver directories (virtual/URL)

define('HTTP_SERVER', 'http://www.********.com'); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', 'https://www.******.com'); // eg, https://localhost - should not be empty for productive servers

define('ENABLE_SSL', true); // secure webserver for checkout procedure?

define('HTTP_COOKIE_DOMAIN', 'www.*****.com');

define('HTTPS_COOKIE_DOMAIN', 'www.*****.com');

define('HTTP_COOKIE_PATH', '/');

define('HTTPS_COOKIE_PATH', '/');

define('DIR_WS_HTTP_CATALOG', '/');

define('DIR_WS_HTTPS_CATALOG', '/');

define('DIR_WS_IMAGES', 'images/');

define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 

REMOVE THE WWW. FROM THE COOKIE DOMAIN LINES

Link to comment
Share on other sites

It's not possible, as you have not provided the real web address, to say whether or not your http and/or https cookie domains should be with or without the www. - you are the only one who knows how the cert was issued.

 

The http:// and https:// is not part of cookie_domain, because it's a domain and not a url. However they are part of the http and https server addresses.

 

Your problem seems to be that either cURL is not compiled into PHP or else it is in a non-standard location. You will need to find out from your hosts if cURL is compiled into PHP and, if so, where it is located.

 

Vger

Link to comment
Share on other sites

It's not possible, as you have not provided the real web address, to say whether or not your http and/or https cookie domains should be with or without the www. - you are the only one who knows how the cert was issued.

 

The http:// and https:// is not part of cookie_domain, because it's a domain and not a url. However they are part of the http and https server addresses.

 

Your problem seems to be that either cURL is not compiled into PHP or else it is in a non-standard location. You will need to find out from your hosts if cURL is compiled into PHP and, if so, where it is located.

 

Vger

 

The cert was issued with the www. I know cURL is compiled as my php info shows that. How would I go about telling this script exactly where to find cURL?

 

-Ryan

rkoechel2004

Link to comment
Share on other sites

The cert was issued with the www. I know cURL is compiled as my php info shows that. How would I go about telling this script exactly where to find cURL?

 

-Ryan

 

 

I found the problem. Php safe mode needs to be off

 

I'm back in business

Thanks for your ideas

 

-Ryan

rkoechel2004

Link to comment
Share on other sites

Module works for the most part. THANK YOU!

 

When I submit a bogus credit card number, address or expiration date the error gets caught and user goes back to payment page. When I submit a false CCV user goes to confirmation page and then after submitting the order gets redirected to

checkout_payment.php

 

the redirect looks like this

checkout_payment.php?error_message=This%20transaction%20has%20been%20declined.%20-%20Your+credit+card+could+not+be+authorized+for+this+reason.+Please+correct+any+i
nformation+and+try+again+or+contact+us+for+further+assistance.&osCsid=8b66601a82524f5de28fc3b7762a3ded

 

I added some lines in checkout_payment.php to properly display the error, but why isn't the CCV mistake gettin caught like the rest?

Link to comment
Share on other sites

Module works for the most part. THANK YOU!

 

When I submit a bogus credit card number, address or expiration date the error gets caught and user goes back to payment page. When I submit a false CCV user goes to confirmation page and then after submitting the order gets redirected to

checkout_payment.php

 

the redirect looks like this

checkout_payment.php?error_message=This%20transaction%20has%20been%20declined.%20-%20Your+credit+card+could+not+be+authorized+for+this+reason.+Please+correct+any+i
nformation+and+try+again+or+contact+us+for+further+assistance.&osCsid=8b66601a82524f5de28fc3b7762a3ded

 

I added some lines in checkout_payment.php to properly display the error, but why isn't the CCV mistake gettin caught like the rest?

 

The credit card number are caught in oscommerce by using an algorithm called the lunhcheck, with determines if a CC number is valid or not (there is a formula for this). For the CVV, there is no formula: it's getting back from Authorize net itself, thats checks the actual cvv against its database. It's not handled by oscommerce like the CC numbers, that's why it's coming back AFTER the payment submission, not filtered BEFORE

Edited by pixclinic
Link to comment
Share on other sites

This module works GREAT.

 

Anyone wanting to process credit cards with Authorize.net and OSCommerce should scrap the built in module and use this third party module (assuming you have SSL).

 

After wasting about 6 hours in researching the forums and speaking to Authorize.net support, I was unable to make the Authorize.net Payment Module supplied with OSCommerce to work.

 

I downloaded the contribution file and had it installed and configured in 15 minutes.

 

<http://www.oscommerce.com/community/contributions,4091/category,1/search,authorize>

 

I was able to run a test transaction successfully.

 

Thank you for the great work and contribution to the OSCommerce community.

Link to comment
Share on other sites

pixclinic,

 

Thank you thank you thank you.

 

I am stupid, i never went over /checkout_confirmation.php when testing this mod.

I thought the error message should appear at this step, should have known better ...

Have a nice weekend,

 

Chris

 

 

I am having the same problem as Chris was. The authorize.net just goes straight to the confirm_checkout.php blank with no error messages at all. What did you mean by I never went over /checkout_confirmation.php when installing the mod?

 

-Brian

Link to comment
Share on other sites

pixclinic,

 

Thank you thank you thank you.

 

I am stupid, i never went over /checkout_confirmation.php when testing this mod.

I thought the error message should appear at this step, should have known better ...

Have a nice weekend,

 

Chris

 

 

I am having the same problem as Chris was. The authorize.net just goes straight to the confirm_checkout.php blank with no error messages at all. What did you mean by I never went over /checkout_confirmation.php when installing the mod?

 

-Brian

Link to comment
Share on other sites

I am having the same problem as Chris was. The authorize.net just goes straight to the confirm_checkout.php blank with no error messages at all. What did you mean by I never went over /checkout_confirmation.php when installing the mod?

 

-Brian

 

place the order COMPLETELY, all through the end.

Link to comment
Share on other sites

place the order COMPLETELY, all through the end.

 

As they seem to be getting a blank checkout_confirmation.php page that's going to be a bit difficult.

 

It looks like error reporting is tured off on the server, hence the blank page and no error message.

 

Are you running the site with Register Globals off in php.ini?

 

Vger

Link to comment
Share on other sites

Vger,

 

Ive followed the instructions on the new Authorize.net AIM module. I installed/uploaded and setup up everything correctly. I have a valid Authorize.net account, a ssl cert working and php compiled with-curl. I installed the module and entered the information needed. When confirming order i get

 

(TESTMODE) The merchant login ID or password is invalid or the account is inactive. - Your credit card could not be authorized for this reason. Please correct any information and try again or contact us for further assistance.

 

I am getting the same error message.

 

My login and transaction key are correct.

I'm using an https connection

I installed the new files, and made the corrections to the other 2

I was already using AIM, so my version is 3.1, and these settings are correct:

Delimited Response = No

Default Field Seperator = comma

Field Encapsulation Character = blank

 

Any idea why I keep getting the error?

 

Thanks.

Link to comment
Share on other sites

First off, I'd like to thank Vger for a wonderful contribution. I am currently using it on my own site. There were some changes I made to his code, and I've posted a new version of the this module in the contribs.

 

The next order number in the database wasn't being correctly calculated. Changes I made follow. Note: lines with a - are old lines, lines with a + are my changes.

 

-		 $last_order_id = tep_db_query("select * from " . TABLE_ORDERS . " order by orders_id desc limit 1");
-		 $new_order_id = $last_order_id->fields['orders_id'];
-		 $new_order_id = ($new_order_id + 1);
+		 $new_order_id_qry = tep_db_query("show table status like '" . TABLE_ORDERS . "'");
+		 $new_order_id_result = tep_db_fetch_array($new_order_id_qry);
+		 $new_order_id = $new_order_id_result['Auto_increment'];

 

 

Next, for some reason, at least on my setup, the CVV wasn't correctly being passed to authorize.net. I found it necessary to do an explicit string to integer conversion:

 

-		 x_card_code => $_POST['cc_cvv'],
+		 x_card_code => $_POST['cc_cvv'] + 0, // CVV doesn't get passed unless it is converted to integer

 

Finally, I added the customer's ip address to the info passed to authorize.net:

 

+		 x_customer_ip => $_SERVER['REMOTE_ADDR'],

 

I hope everyone finds this helpful!

Link to comment
Share on other sites

my problem was in the cc_validation.php file. A previous installation of the mod "add CVV" to the offline other method was responsible for the error.

 

Never mind :-)

Hugh,

 

I'm getting the exact same error. What did you do to correct it?

 

Thanks,

ed

Link to comment
Share on other sites

Awesome module, thanks!

 

Everything seems to be working perfectly.

 

One question I have is about the CVV. I tried it on the test server with an incorrect CVV to see if it would throw an error. It didn't.

 

I then went to my authorize.net card code settings, and I checked ALL of the boxes:

 

Reject Transaction If Card Code value...

x Does NOT Match (N)

x Is NOT Processed (P)

x Should be on card, but is not indicated (S)

x Issuer is not certified or has not provided encryption key (U)

 

Then I tried it again, with all my CC info, and an incorrect CCV value, and it still went through with no errors.

 

Is this by design or is there something I'm missing?

 

Thanks,

Brian

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...