Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

authorize.net problems


RoninS14

Recommended Posts

For the record, I still don't have it working. I am close though. I got the response that the payment has been authorized and it is routing me to the proper page. However, I still haven't taken Authorize.net live because I still haven't seen any transactions on their site.

 

Well, here's the latest.

 

So I found that even though you are testing, you need to make the "Authorize.net Credit Card AIM" Live. Turns out that in the default settings for osc's authorizenet, "Test" means that you are submitting requests to https://test.authorize.net/gateway/transact.dll. This is the wrong gateway to send it to unless your API login starts with "cpdev" or "cnpdev". The server will return error 13 message (basically wrong username or password). The correct test server if your API login doesn't start with "cpdev" or "cnpdev" is the same as the live server: https://secure.authorize.net/gateway/transact.dll

For testing, you need to make sure that Authorize.net is in test mode.

 

To do this, log in to Administration.

In the left navigation click on Modules then Payment

In the center list, click on Authorize.net Credit Card AIM

On the right, you will see the settings. Set them as follows:

 

 

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

Enable Authorize.net Credit Card AIM

Do you want to accept Authorize.net Credit Card AIM payments?

 

True *

False

 

Login ID xxxxxxxxxx

The login ID used for the Authorize.net service

 

 

Transaction Key xxxxxxxxxxx

Transaction key used for encrypting data

 

 

MD5 Hash xxxxxxxxxxxxxxxxxxxxxxx (same as in authorize.net settings)

The MD5 hash value to verify transactions with

 

 

Transaction Server

Perform transactions on the live or test server. The test server should only be used by developers with Authorize.net test accounts.

 

Live *

Test

 

Transaction Mode

Transaction mode used for processing orders

 

Live *

Test

 

Transaction Method

The processing method to use for each transaction.

 

Authorization

Capture *

 

Payment Zone (personal configuration)

If a zone is selected, only enable this payment method for that zone.

 

 

 

Set Order Status (personal configuration)

Set the status of orders made with this payment module to this value

 

 

Sort order of display. **Not necessary**(0=first in the list 99=last in the list)

Sort order of display. Lowest is displayed first.

 

 

cURL Program Location

The location to the cURL program application.

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

 

 

After these settings were correct, I was at least getting Authorize.net to correctly identify me, but I was still getting errors. The error I was getting was that it wasn't sending an invoice number. So I added some code.

 

You need to BACKUP!! BACKUP!! BACKUP!! BACKUP!! then find a bit of code in catalog/includes/modules/payment/authorizenet_cc_aim.php that looks like this:

 

function before_process() {

global $HTTP_POST_VARS, $customer_id, $order, $sendto, $currency;

 

$params = array('x_login' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN_ID, 0, 20),

'x_tran_key' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_KEY, 0, 16),

'x_version' => '3.1',

'x_delim_data' => 'TRUE',

'x_delim_char' => ',',

'x_encap_char' => '"',

'x_relay_response' => 'FALSE',

'x_first_name' => substr($order->billing['firstname'], 0, 50),

'x_last_name' => substr($order->billing['lastname'], 0, 50),

'x_company' => substr($order->billing['company'], 0, 50),

'x_address' => substr($order->billing['street_address'], 0, 60),

'x_city' => substr($order->billing['city'], 0, 40),

'x_state' => substr($order->billing['state'], 0, 40),

'x_zip' => substr($order->billing['postcode'], 0, 20),

'x_country' => substr($order->billing['country']['title'], 0, 60),

'x_phone' => substr($order->customer['telephone'], 0, 25),

'x_cust_id' => substr($customer_id, 0, 20),

'x_customer_ip' => tep_get_ip_address(),

'x_email' => substr($order->customer['email_address'], 0, 255),

'x_description' => substr(STORE_NAME, 0, 255),

'x_amount' => substr($this->format_raw($order->info['total']), 0, 15),

'x_currency_code' => substr($currency, 0, 3),

'x_method' => 'CC',

'x_type' =>

 

And Replace it with this:

 

function before_process() {

global $HTTP_POST_VARS, $customer_id, $invoice_id, $order, $sendto, $currency;

 

$next_inv = '';

$inv_id = tep_db_query("select orders_id from " . TABLE_ORDERS . " order by orders_id DESC limit 1");

$last_inv = tep_db_fetch_array($inv_id);

$next_inv = $last_inv['orders_id']+1;

 

$params = array('x_login' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN_ID, 0, 20),

'x_tran_key' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_KEY, 0, 16),

'x_version' => '3.1',

'x_delim_data' => 'TRUE',

'x_delim_char' => ',',

'x_encap_char' => '"',

'x_relay_response' => 'FALSE',

'x_invoice_num' => substr($next_inv, 0, 20),

'x_first_name' => substr($order->billing['firstname'], 0, 50),

'x_last_name' => substr($order->billing['lastname'], 0, 50),

'x_company' => substr($order->billing['company'], 0, 50),

'x_address' => substr($order->billing['street_address'], 0, 60),

'x_city' => substr($order->billing['city'], 0, 40),

'x_state' => substr($order->billing['state'], 0, 40),

'x_zip' => substr($order->billing['postcode'], 0, 20),

'x_country' => substr($order->billing['country']['title'], 0, 60),

'x_phone' => substr($order->customer['telephone'], 0, 25),

'x_cust_id' => substr($customer_id, 0, 20),

'x_customer_ip' => tep_get_ip_address(),

'x_email' => substr($order->customer['email_address'], 0, 255),

'x_description' => substr(STORE_NAME, 0, 255),

'x_amount' => substr($this->format_raw($order->info['total']), 0, 15),

'x_currency_code' => substr($currency, 0, 3),

'x_method' => 'CC',

'x_type' =>

 

 

Now I am still having trouble with this script because it keeps requiring company. If you customers have a blank field where company is, then it will return a an error. I am still playing with it, but I think if you just comment out that line, it may just pass through without any errors. I realize that commenting it out isn't much of a solution, but if it posts transactions for the time being, I'm all for it.

 

Let me know if you guys can think of anything that might help.

 

Joshua Morris

Link to comment
Share on other sites

  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

Ok... I got it to work. Hope this helps everybody.

 

Its not a problem with the script. Don't comment out the script. I was on the Live help with Authorize.net for a couple of hours now.

 

Thurns out you need to make sure that certain fields are not required for your authorization to go through.

 

Go to https://account.authorize.net

 

Click on the following:

 

Under "Account"

Click=> Settings

Click=>Payment Form

Click=>Form Fields

 

You should come to a page that looks like this. Fill it in with your personal settings similar to this.

 

Remember: **If you require it here, and you don't require it in OSCommerce account setup, your customers will recieve an error for those blank fields and payment will be impossible.**

With the line of code I put above, you can now require an invoice number.

 

 

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

Payment-Form Fields

 

Field Name--------------------------------------View-------------Edit------------Required

Payment Information

Recurring Billing Transaction-----------------o-----------------o------------------o

Card Code------------------------------------------o-----------------o------------------o

 

Order Information

Invoice No---------------------------------------x------------------o------------------x

Description--------------------------------------x------------------o------------------x

 

Customer Billing Information

First Name--------------------------------------x------------------x------------------x

Last Name--------------------------------------x------------------x------------------x

Company---------------------------------------x------------------x------------------o

Address-----------------------------------------x------------------x------------------x

City----------------------------------------------x------------------x------------------x

State--------------------------------------------x------------------x------------------x

Zip Code----------------------------------------x------------------x------------------x

Country-----------------------------------------x------------------x------------------o

Phone-------------------------------------------x------------------x------------------o

Fax----------------------------------------------x------------------x------------------o

Email--------------------------------------------x------------------x------------------x

Customer ID-----------------------------------x------------------o------------------x

 

Shipping Information

First Name--------------------------------------x------------------x------------------x

Last Name--------------------------------------x------------------x------------------x

Company---------------------------------------x------------------x------------------o

Address-----------------------------------------x------------------x------------------x

City----------------------------------------------x------------------x------------------x

State--------------------------------------------x------------------x------------------x

Zip Code----------------------------------------x------------------x------------------x

Country-----------------------------------------x------------------x------------------o

 

Additional Information

Tax-----------------------------------------------o-----------------o------------------o

Freight-------------------------------------------o-----------------o------------------o

Duty----------------------------------------------o-----------------o------------------o

Tax Exempt--------------------------------------o-----------------o------------------o

PO Number--------------------------------------o-----------------o------------------o

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

 

Let me know if this helps anybody.

 

Joshua Morris

Link to comment
Share on other sites

So I have been searching the forum for weeks now to find a solution to this same problem. I think I am getting closer with "fwrite" script.

 

Here is the log.

 

SENT: x_login=xxxxxxxxx&x_tran_key=xxxxxxxxxxxxxxx&[truncated]
RESPONSE: "3","2","13","(TESTMODE) The merchant login ID or password is invalid or the account is [truncated]
POST: x=43
POST: y=6
Done.

 

 

I think something in the script is not relaying properly. I verified that my login and transaction id were correct, but still nothing.

 

I have tried every possible setting from the admin. I got it to partially work 1 time. Authorize.net shows the transaction, but my site doesn't, nor was I ever routed back to my site.

 

I am gonna play with the code a bit and see if there is maybe a contribution I can add to solve this problem. I really need this to work as do many of us.

 

Joshua Morris

 

Josh,

 

Would you mind describing how and where you set up fwrite to write all those POST/RESPONSE variables to a log? I've been having trouble with the AIM module as well (stopped working out of the blue), and I'd like to capture whatever error codes might be coming through so I can troubleshoot further.

 

Thanks!

Link to comment
Share on other sites

(Sorry for the double post, but can we not edit out own posts here?)

 

Josh: what version of the AIM module are you using? Emailmaomao's (Vger's originally, I think) or ponce's?

 

Also, I tried adding the code from this topic: http://www.oscommerce.com/forums/index.php?t103839.html , but the versions of the AIM module that I'm using don't even have a file called authorize_direct.php, so I'm assuming it only works with a very old version. Does the code you're using look similar? In what file did you have to insert it to get it to write the response codes to a file?

 

Thanks

Link to comment
Share on other sites

Hey madinchina,

 

Sorry I didn't respond right away. Its the weekend and all.....

 

So what you want to do is add a bit of script to your authorizenet file found here:

 

catalog/includes/modules/payment/authorizenet_cc_aim.php, about line 182

 

After a script that looks about like so:

 

switch (MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_SERVER) {

case 'Live':

$gateway_url = 'https://secure.authorize.net/gateway/transact.dll';

break;

 

default:

$gateway_url = 'https://test.authorize.net/gateway/transact.dll';

break;

}

 

$transaction_response = $this->sendTransactionToGateway($gateway_url, $post_string);

 

 

if (!empty($transaction_response)) {

$regs = preg_split("/,(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))/", $transaction_response);

 

 

 

Add this script:

 

// begin logging of post variables, authorize.net request, and authorize.net response

 

$myFile = "/home/your-path/file.txt";

$fh = fopen($myFile, 'a') or die("can't open file");

$stringData = "\nSENT: ".$post_string;

fwrite($fh, $stringData);

$stringData = "\nRESPONSE: ".$transaction_response;

fwrite($fh, $stringData);

foreach($HTTP_POST_VARS as $key => $value) {

$stringData = "\nPOST: $key=$value";

fwrite($fh, $stringData);

}

fwrite($fh, "\nDone.\n");

fclose($fh);

 

// end logging

 

IMPORTANT!!!

 

In this line...

 

$myFile = "./home/your-path/file.txt";

 

make sure that you put the correct path. The WHOLE path...NOT JUST "www.mysite.com/catalog..." Its got to include the server path.

 

You can find this information pretty much all over your site, but a quick dirty way to find this path would be on the admin side. Log into your oscommerce administration and on the left side click:

 

Tools > File Manager

 

Up at the top under the heading "File Manager" you will see your full path. While you are in the file manager, create a new file in the path in which you want to store your logs called "file.txt". Use this path to the file. I recommend adding a few folders to try and hide the info a bit.

 

Once you read the file, if you still need it, copy and past it to your local machine, but DO NOT under any circumstances, leave this info on your live server. That is a hackers paradise, and I'd love you to death if you did that for me... **WINK** **WINK**

 

NO...SERIOUSLY!!! DO NOT LEAVE IT THERE! DELETE IT IMMEDIATELY!

 

To read the file all you have to do is type in your web address bar the path and the file like so:

 

http://www.yoursite.com/catalog/path_to_your_file/file.txt

 

REMEMBER!! Once you read it, CLEAR IT! You can easily and quickly do this by using the "File Manger"

 

 

Once you have fixed your problem, and you are back on line.... you should simply comment out the script like this:

 

/*

 

<script>

 

*/

 

This way, if it ever fails again, you can easily turn the script back on for troubleshooting.

 

You can also leave the file.txt there, just make sure it is blank and the fwrite script is blank.

 

Also, for the record, I am using V1.0.

 

Let me know if this helps you guys.

 

Joshua Morris

Link to comment
Share on other sites

I've never been so excited to get an error message in my life. :lol:

 

Here's the (censored where appropriate) info from my log:

 

SENT: x_login=[...]&x_tran_key=[...]&x_version=3.1&x_delim_data=TRUE&x_delim_char=%2C&x_encap_char=%22&
x_relay_response=FALSE&x_first_name=Peter&x_last_name=Magenheimer&x_company=&x_address=[...]&x_city=[...]&x_state=[...]&
x_zip=[...]&x_country=United+States&x_phone=[...]&x_cust_id=[...]&x_customer_ip=[...]&x_email=[...]&x_description=[...]&
x_amount=7.30&x_currency_code=USD&x_method=CC&x_type=AUTH_CAPTURE&x_card_num=&x_exp_date=&x_card_code=&
x_ship_to_first_name=Peter&x_ship_to_last_name=Magenheimer&x_ship_to_company=&x_ship_to_address=[...]&x_ship_to_city=[...]&
x_ship_to_state=[...]&x_ship_to_zip=80526&x_ship_to_country=United+States&x_freight=6.30&x_line_item=1<|>[...]<|>[...]<|>1<|>1.00<|>NO
RESPONSE: "3","2","33","Credit card number is required.","","P","0","","[...]","7.30","CC","auth_capture","[...]","Peter","Magenheimer",""
,"[...]","[...]","[...]","[...]","United States","[...]","","[...]","Peter","Magenheimer","","[...]","[...]","[...]","[...]","United States"
,"","","6.3000","","","[...a 128 bit hex value]","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
POST: x=45
POST: y=7
Done.

 

(Note specifically the blank x_card_num, x_exp_date, and x_card_code, despite the fact that I gave valid CC info for the transaction. Also, the 128-bit hex value I censored in the RESPONSE, but it looks like an MD5 hash.)

 

I should probably also note that the MD5 hash field in the AIM module config (and as far as I know, on the authorize.net account setup) is blank, since the site had previously been using a different AIM module (one without the MD5 field). Is the MD5 required by this module/a.net? If so, do I just need to set any MD5 hash in a.net's account settings and then match it on osC's side, or is there another process? I'd check myself, but I don't have the client's authorize.net login details, so I'll need to guide him through the process.

Link to comment
Share on other sites

I would definitely include an MD5 Hash. In fact, here is a free site that will generate one for you. Simply put any string of characters like (password, or p@55w0rD!, or even something as simple as "me") and then click md5. POOF!!! There is your new MD5 Hash. Past the same string on your website and at authorize.net.

 

Should look kinda like this: 3c6e0b8a9c15224a8228b9a98ca1531d

 

Thats all there is to it.

 

I don't know if that will solve your problem though. Check your code to make sure that it is submitting the proper info.

 

If you need help with that, let me know. I'll go into greater detail.

 

Joshua Morris

Link to comment
Share on other sites

Thanks again. I'm still waiting on the client so I can have him log in to a.net and make the changes, so for now, I've been casually playing around with authorizenet_cc_aim.php to see if I can make it send the CC info without using the MD5 hash. It looks like the code does have a conditional to avoid using that hash function if there isn't an MD5 hash specified in the module's config, but I'm not sure if that's working correctly since the module is just sending blank CC info.

 

Another possibility that I was thinking of is that the module itself is significantly newer than the version of osCommerce I'm using on the site (2.2-MS2), so it might be attempting to send variables to one of the checkout_.php pages when that page isn't equipped to accept those variables. For example, the AIM module that the site was using before requested the user's CC info on the checkout_payment.php page, whereas this module requests the user's CC info on checkout_confirmation.php instead. Could this be a problem?

 

Any ideas? Also, what version of osCommerce are you using?

Edited by madinchina
Link to comment
Share on other sites

Thank you very much! I'll try this tomorrow and see what I get. Then maybe Authorize.net's support will be a bit more helpful.

 

I didn't find Authorize.net to be very helpful at all. I contacted their online live support because I was looking at all the setting, and they were correct. I asked her to change the requirements of the info I am supposed to be sending. She told me that they don't have requirements, so it is a problem in the carts script. She said that I needed to contact my provider. She proceeded to mock me when I explained to her that I was using a highly modified open source shopping cart and that I was the provider of that cart, and the script was correct. Frustrated, I ultimately started asking her simple questions about my account which lead her right into my trap. Whatever she did during he research to answer my questions, somehow my account started working.

 

Good times, Good times!

 

Sorry I forgot to include the hash generator last time. http://www.miraclesalad.com/webtools/md5.php

 

I am using OSC v2.2 RC 2a. What version are you using?

Link to comment
Share on other sites

Well, this is strange... Suddenly, the authorizenet_cc_aim.php module is giving me an error:

 

Fatal error: Cannot redeclare class authorizenet_cc_aim in /home/mnhookah/public_html/includes/modules/payment/authorizenet_cc_aim.php on line 13

 

I tried reverting to the original file, but still the same problem (it obviously has nothing to do with your fwrite script, since the error's on the first non-comment line of the code). Any ideas on why that's appearing out of the blue? I'm starting to think that this site's webhost (Siteground) sucks...

 

I'm using osCommerce 2.2-MS2.

Edited by madinchina
Link to comment
Share on other sites

Fix your code with this. Here is the first part of the class constructor code.

 

// class constructor
   function authorizenet_cc_aim() {
     global $order;

     $this->signature = 'authorizenet|authorizenet_cc_aim|1.0|2.2';

     $this->code = 'authorizenet_cc_aim';
     $this->title = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_TITLE;
     $this->public_title = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_PUBLIC_TITLE;
     $this->description = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_PAYMENT_AUTHORIZENET_CC_AIM_SORT_ORDER;
     $this->enabled = ((MODULE_PAYMENT_AUTHORIZENET_CC_AIM_STATUS == 'True') ? true : false);

Link to comment
Share on other sites

Argh, my own stupid mistake strikes again! :rolleyes:

 

I'd accidentally uploaded the authorizenet_cc_aim.php module into the /includes/languages/english/modules/payment/ folder, instead of the appropriate language file. The module was in the correct folder, calling a duplicate of itself (or something) from that language folder. That's why I was getting the redeclare PHP error.

 

Anyway, now that I've got this module back, I'll try the MD5 hash and get back to you.

Edited by madinchina
Link to comment
Share on other sites

Okay, so we changed the MD5 hash field in his auth.net account and on the module settings to an 11-letter keyword (as Auth.net's tech support suggested) instead of a full MD5 hash value. We also tried using an actual 128-bit MD5 hash, but no luck on either front. The module is still sending no CC data. I'm going to spend some time diving into to the module's PHP and OSC's checkout process PHP to see if I can't find out what's going on. Any suggestions or guidance would be great.

 

What's your MD5 setup like on your site? Are you using an actual MD5 hash in both fields (the osCommerce module setup and the auth.net account settings), a "keyword" in both fields, or are there two different values between fields? I'm pretty sure we had it set up correctly (which is why I'm going to explore some other areas), but I just want to make sure.

 

Thanks!

Link to comment
Share on other sites

So, I sent a support ticket to the client's web host, and it seems they tinkered around with something (even though they said they couldn't help any further). Whatever they did (I'm assuming they recompiled cURL or something), they partially fixed the problem. Then emailmaomao's (Vger's) version of the AIM module started giving me the following error code from Auth.net, instead of absolutely nothing from Auth.net as it was doing earlier today:

 

RESPONSE: 3,2,13,The merchant login ID or password is invalid or the account is inactive.

 

I realized that the version of the AIM module has the wrong production mode URL (https://test.authorize.net/gateway/transact.dll instead of 'https://secure.authorize.net/gateway/transact.dll), so I fixed that and now AIM is working again!

 

Thanks again for all your help. If you're still interested in the problem with the other AIM module (Ponce's version), let me know and we can work on it more, but it's not a big priority any more now that we have some form of AIM running on the site.

Link to comment
Share on other sites

  • 1 month later...
Okay, I've been researching this for a week and still haven't figured out why my authorize.net module isn't working. I haven't even been able to find a thread which was dedicated entirely to "setting up" the authorize.net module so I've been searching the hundred of threads relating to auth.net to find a solution to my problem.

 

Now depending on which authorize.net module I use, I get a different error.

 

I've tried vger's version march 18 and I get the "There has been an error processing your credit card".

 

I've tried ponce's version jan 11 2008 and I get the "There has been an error processing your credit card".

 

I've tried the default authorize.net version bundled in OSC and still no luck.

 

There appears to be a million threads about the many different errors and solutions for each. I've looked through just about all of the one's that I thought pertained to my problem and I still can't get it to work.

 

I have followed all instructions provided by each thread and each modules without success.

 

Some seem to have a easy time getting auth.net to work while others never seem to find a solution to their problems.

 

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

"There has been an error processing your credit card

Please try again and if problems persist, please try another payment method."

 

above is the error I am getting using ponce's version of AIM for authorize.net. which is the version that I would prefer to use. Now if I'm told to use a different version, then I will. But it seems that ponce's version is the newest of the greatest and I'd like to get it to work.

 

 

I am hosted with pair networks (the osc sponsor) running php5/mysql5. I have curl compiled on there so I know that this is not the problem. With ponce's version of the AIM module, I tried setting the curl field to "usr/bin/curl" and just "curl". I get the same results, error.

 

===In my settings for A.net (TESTMODE)

 

-I have enabled the following in " Upload Transaction File Format":

 

Email Customer: yes

Apply AVS Filter: no

Apply Card Code Filter: no

field separator: comma(,)

Field Encapsulation Character: blank

 

-In the "transaction version", I am using the 3.1 version

 

-In the "response/receive URL", I have the following:

 

URL

https://www.mydomain.com/checkout_process.php Default Receipt URL Edit

https://www.mydomain.com/checkout_process.php Default Relay Response URL Edit

 

-I did not touch

 

-In the "address verification service", I have the default values seclected.

 

-I've set my MD5hash and entered it in the "MD5hash" field in OSC's administration > modules > payment > Authorize.net Credit Card AIM

 

-I've enabled "password required mode"

 

-I've enabled "file uploads capabilities"

 

-I do not have weblink activated

 

-and I've entered my API and transkey into the proper fields of OSC's administration > modules > payment > Authorize.net Credit Card AIM

 

 

Am I missing something?

 

 

 

To all,

 

I know this is a dated post, but my understanding (according to authorize.net) is if you enable Password required, you cannot activate Weblink and that Relay/Response should be left blank.

 

Cordially,

Hank

Link to comment
Share on other sites

Ok... I got it to work. Hope this helps everybody.

 

Its not a problem with the script. Don't comment out the script. I was on the Live help with Authorize.net for a couple of hours now.

 

Thurns out you need to make sure that certain fields are not required for your authorization to go through.

 

Go to https://account.authorize.net

 

Click on the following:

 

Under "Account"

Click=> Settings

Click=>Payment Form

Click=>Form Fields

 

You should come to a page that looks like this. Fill it in with your personal settings similar to this.

 

Remember: **If you require it here, and you don't require it in OSCommerce account setup, your customers will recieve an error for those blank fields and payment will be impossible.**

With the line of code I put above, you can now require an invoice number.

 

 

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

Payment-Form Fields

 

Field Name--------------------------------------View-------------Edit------------Required

Payment Information

Recurring Billing Transaction-----------------o-----------------o------------------o

Card Code------------------------------------------o-----------------o------------------o

 

Order Information

Invoice No---------------------------------------x------------------o------------------x

Description--------------------------------------x------------------o------------------x

 

Customer Billing Information

First Name--------------------------------------x------------------x------------------x

Last Name--------------------------------------x------------------x------------------x

Company---------------------------------------x------------------x------------------o

Address-----------------------------------------x------------------x------------------x

City----------------------------------------------x------------------x------------------x

State--------------------------------------------x------------------x------------------x

Zip Code----------------------------------------x------------------x------------------x

Country-----------------------------------------x------------------x------------------o

Phone-------------------------------------------x------------------x------------------o

Fax----------------------------------------------x------------------x------------------o

Email--------------------------------------------x------------------x------------------x

Customer ID-----------------------------------x------------------o------------------x

 

Shipping Information

First Name--------------------------------------x------------------x------------------x

Last Name--------------------------------------x------------------x------------------x

Company---------------------------------------x------------------x------------------o

Address-----------------------------------------x------------------x------------------x

City----------------------------------------------x------------------x------------------x

State--------------------------------------------x------------------x------------------x

Zip Code----------------------------------------x------------------x------------------x

Country-----------------------------------------x------------------x------------------o

 

Additional Information

Tax-----------------------------------------------o-----------------o------------------o

Freight-------------------------------------------o-----------------o------------------o

Duty----------------------------------------------o-----------------o------------------o

Tax Exempt--------------------------------------o-----------------o------------------o

PO Number--------------------------------------o-----------------o------------------o

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

 

Let me know if this helps anybody.

 

Joshua Morris

 

 

Good day,

 

How do you discern what fields are set as required in osCommerce?

 

Cordially,

Hank

Link to comment
Share on other sites

For the record, I still don't have it working. I am close though. I got the response that the payment has been authorized and it is routing me to the proper page. However, I still haven't taken Authorize.net live because I still haven't seen any transactions on their site.

 

Well, here's the latest.

 

So I found that even though you are testing, you need to make the "Authorize.net Credit Card AIM" Live. Turns out that in the default settings for osc's authorizenet, "Test" means that you are submitting requests to https://test.authorize.net/gateway/transact.dll. This is the wrong gateway to send it to unless your API login starts with "cpdev" or "cnpdev". The server will return error 13 message (basically wrong username or password). The correct test server if your API login doesn't start with "cpdev" or "cnpdev" is the same as the live server: https://secure.authorize.net/gateway/transact.dll

For testing, you need to make sure that Authorize.net is in test mode.

 

To do this, log in to Administration.

In the left navigation click on Modules then Payment

In the center list, click on Authorize.net Credit Card AIM

On the right, you will see the settings. Set them as follows:

 

 

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

Enable Authorize.net Credit Card AIM

Do you want to accept Authorize.net Credit Card AIM payments?

 

True *

False

 

Login ID xxxxxxxxxx

The login ID used for the Authorize.net service

 

 

Transaction Key xxxxxxxxxxx

Transaction key used for encrypting data

 

 

MD5 Hash xxxxxxxxxxxxxxxxxxxxxxx (same as in authorize.net settings)

The MD5 hash value to verify transactions with

 

 

Transaction Server

Perform transactions on the live or test server. The test server should only be used by developers with Authorize.net test accounts.

 

Live *

Test

 

Transaction Mode

Transaction mode used for processing orders

 

Live *

Test

 

Transaction Method

The processing method to use for each transaction.

 

Authorization

Capture *

 

Payment Zone (personal configuration)

If a zone is selected, only enable this payment method for that zone.

 

 

 

Set Order Status (personal configuration)

Set the status of orders made with this payment module to this value

 

 

Sort order of display. **Not necessary**(0=first in the list 99=last in the list)

Sort order of display. Lowest is displayed first.

 

 

cURL Program Location

The location to the cURL program application.

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

 

 

After these settings were correct, I was at least getting Authorize.net to correctly identify me, but I was still getting errors. The error I was getting was that it wasn't sending an invoice number. So I added some code.

 

You need to BACKUP!! BACKUP!! BACKUP!! BACKUP!! then find a bit of code in catalog/includes/modules/payment/authorizenet_cc_aim.php that looks like this:

 

function before_process() {

global $HTTP_POST_VARS, $customer_id, $order, $sendto, $currency;

 

$params = array('x_login' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN_ID, 0, 20),

'x_tran_key' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_KEY, 0, 16),

'x_version' => '3.1',

'x_delim_data' => 'TRUE',

'x_delim_char' => ',',

'x_encap_char' => '"',

'x_relay_response' => 'FALSE',

'x_first_name' => substr($order->billing['firstname'], 0, 50),

'x_last_name' => substr($order->billing['lastname'], 0, 50),

'x_company' => substr($order->billing['company'], 0, 50),

'x_address' => substr($order->billing['street_address'], 0, 60),

'x_city' => substr($order->billing['city'], 0, 40),

'x_state' => substr($order->billing['state'], 0, 40),

'x_zip' => substr($order->billing['postcode'], 0, 20),

'x_country' => substr($order->billing['country']['title'], 0, 60),

'x_phone' => substr($order->customer['telephone'], 0, 25),

'x_cust_id' => substr($customer_id, 0, 20),

'x_customer_ip' => tep_get_ip_address(),

'x_email' => substr($order->customer['email_address'], 0, 255),

'x_description' => substr(STORE_NAME, 0, 255),

'x_amount' => substr($this->format_raw($order->info['total']), 0, 15),

'x_currency_code' => substr($currency, 0, 3),

'x_method' => 'CC',

'x_type' =>

 

And Replace it with this:

 

function before_process() {

global $HTTP_POST_VARS, $customer_id, $invoice_id, $order, $sendto, $currency;

 

$next_inv = '';

$inv_id = tep_db_query("select orders_id from " . TABLE_ORDERS . " order by orders_id DESC limit 1");

$last_inv = tep_db_fetch_array($inv_id);

$next_inv = $last_inv['orders_id']+1;

 

$params = array('x_login' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_LOGIN_ID, 0, 20),

'x_tran_key' => substr(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_TRANSACTION_KEY, 0, 16),

'x_version' => '3.1',

'x_delim_data' => 'TRUE',

'x_delim_char' => ',',

'x_encap_char' => '"',

'x_relay_response' => 'FALSE',

'x_invoice_num' => substr($next_inv, 0, 20),

'x_first_name' => substr($order->billing['firstname'], 0, 50),

'x_last_name' => substr($order->billing['lastname'], 0, 50),

'x_company' => substr($order->billing['company'], 0, 50),

'x_address' => substr($order->billing['street_address'], 0, 60),

'x_city' => substr($order->billing['city'], 0, 40),

'x_state' => substr($order->billing['state'], 0, 40),

'x_zip' => substr($order->billing['postcode'], 0, 20),

'x_country' => substr($order->billing['country']['title'], 0, 60),

'x_phone' => substr($order->customer['telephone'], 0, 25),

'x_cust_id' => substr($customer_id, 0, 20),

'x_customer_ip' => tep_get_ip_address(),

'x_email' => substr($order->customer['email_address'], 0, 255),

'x_description' => substr(STORE_NAME, 0, 255),

'x_amount' => substr($this->format_raw($order->info['total']), 0, 15),

'x_currency_code' => substr($currency, 0, 3),

'x_method' => 'CC',

'x_type' =>

 

 

Now I am still having trouble with this script because it keeps requiring company. If you customers have a blank field where company is, then it will return a an error. I am still playing with it, but I think if you just comment out that line, it may just pass through without any errors. I realize that commenting it out isn't much of a solution, but if it posts transactions for the time being, I'm all for it.

 

Let me know if you guys can think of anything that might help.

 

Joshua Morris

 

 

Joshua and All,

 

The settings and URL solution before all the scripting stuff worked for me.

 

So, thanks.

 

I do not currently have any fields listed as required in the Merchant Interface with Authorize.net.

 

Cordially,

Hank

Link to comment
Share on other sites

Hi Joshua and All,

 

Whew. Fighting this waay to long. And dropping your logging code into place, I see a surprising result: The processor approved the transaction. The module just doesn't understand that.

 

Anyone that have this working care to share their Authnet settings? I've changed mine so many times even my documentation of what I've changed burst into flames and committed suicide (delimits, with/without pass, etc)

 

Some details:

- $Id: authorizenet_cc_aim.php 1803 2008-01-11 18:16:37Z hpdl $

 

- ID, Trans Key, Hash obviously correct (since it spits back an approved message)

 

Live, Live, Capture, No Zone, default Order Status, Sort #0, /usr/bin/curl [RH Enterprise 5/cpanel/dedicated/godaddy SSL-128]

 

Heavily Sanitized Log:

 

SENT: x_login=********&x_tran_key=****************&x_version=3.1&x_delim_data=TRUE&x_delim_char=%2C&x_encap_c
har=%22&x_relay_response=FALSE&x_invoice_num=10&x_first_name=*****&x_last_name=********&x_company=&x_address=
****+******+**&x_city=**+****+****&x_state=California&x_zip=*****&x_country=United+States&x_phone=******
*****&x_cust_id=2&x_customer_ip=**.***.3.27&x_email=*****%40*****.com&x_description=*********
s&x_amount=0.04&x_currency_code=USD&x_method=CC&x_type=AUTH_CAPTURE&x_card_num=4**************&x_exp_date=03
**&x_card_code=***&x_ship_to_first_name=*****&x_ship_to_last_name=*****&x_ship_to_company=&x_ship_to_addre
ss=****+****+****&x_ship_to_city=***+****+****&x_ship_to_state=California&x_ship_to_zip=*****&x_ship_to_
country=United+States&x_freight=0.01&x_line_item=1<|>Test+Product<|>Test+Product<|>1<|>0.03<|>NO
RESPONSE: "1","1","1","(TESTMODE) This transaction has been approved.","000000","P","0","10","*****
**","0.04","CC","auth_capture","2","**first**","**last**","","**address**","**city**","California
","**zip**","United States","**phone**","","**email**","**first**","**last**","","**address**","
**city**","California","**zip**","United States","","","0.0100","","","**my-hash-hex**"
,"","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
POST: cc_owner=**Full Name**
POST: cc_number_nh-dns=**CC Number**
POST: cc_expires_month=03
POST: cc_expires_year=**YY**
POST: cc_cvc_nh-dns=***CVC***
POST: x=78
POST: y=5
Done.

 

The funny thing is that if the processor returns a bad card number, I get an error message in the cart saying that it was declined. But if the processor approves it, I get the generic:

"There has been an error processing your credit card

 

Please try again and if problems persist, please try another payment method. "

 

Predictably, I'm really behind the 8-ball on this project. Any advice? I didn't get anywhere with the latest "$Id: authorizenet_aim.php 23rd August, 2006 18:50:00 Brent O'Keeffe $" module - not even this far...

 

TIA for *any* pointers (most especially for those that are "right" ;))

 

--- Jodie

 

Joshua and All,

 

The settings and URL solution before all the scripting stuff worked for me.

 

So, thanks.

 

I do not currently have any fields listed as required in the Merchant Interface with Authorize.net.

 

Cordially,

Hank

Edited by adrenalynn
Link to comment
Share on other sites

Sorry - doesn't appear that I can edit after n# of mins. . .

 

I put ANet into live mode and confirmed that it IS nailing the card for the amount, the transaction is going all the way through - the osc module is still returning failure. Funky, huh?

Link to comment
Share on other sites

Sorry - doesn't appear that I can edit after n# of mins. . .

 

I put ANet into live mode and confirmed that it IS nailing the card for the amount, the transaction is going all the way through - the osc module is still returning failure. Funky, huh?

 

 

Holy Crud-ole-le' - I think I figured it out. I started excessively logging everything that moved or even wiggled in the module's error handling. I noticed that my MD5 just didn't seem to match-up. I tried puttering with it and it was still not working.

 

Then it dawned on me that what was coming back from Authorize.net didn't LOOK like 128 bits of data (16 hex pairs). Turns out that Auth.net chops off the md5 data in the data input box at [drumroll] 80 bits (10 hex pairs).

 

Of course, when I generated my MD5, I just did an "echo secret |md5sum" giving me 128 bits, and blindly pasted it into the fields at both Auth.net and on OSC. I didn't bother to count the characters at Auth.Net, and it hides them after submit.

 

So, with little hope of success, I just took the 80 MSb (what Auth.Net was returning) and slapped it into OSC - submitted my data not really expecting any love, and BOOM. Checkout Success. [boggle]

 

I'll run a few more tests, but this feels right. Is it too late to go get drunk? "I think I picked the wrong week to stop sniffing glue!" - [Airplane]

 

Thanks all!

 

--- Jodie

Link to comment
Share on other sites

That's GREAT news for you! I would definitely get drunk if I was you.

 

I'm still not getting mine to work. If I get a general error all the time, except when I put in a wrong CC number (where I get a CC declined error instead), I must be getting past the MD5 portion of the problem right? Meaning that this probably won't fix my problem?

Edited by Agtronic
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...