Opencart 1.5.2.1, fresh install, browser cleared, full SSL with curl. I've posted this in the OpenCart forum too.
I'm having a nightmare getting Authorize.net AIM module to work. I have a valid sandbox account with Authorize.net and correct login_id (it's not the username) and tran_key. Direct Response is set to YES in Gateway.
In OpenCart /catalog/controller/payment/authorizenet_aim.php I've added a log write snippet to see what Anet was getting and sending back.
CURL INIT URL:
https://test.authorize.net/gateway/transact.dll
CART VIA AIM TO GATEWAY:
x_login=XXX&x_tran_key=XXX&x_version=3.1&x_delim_data=true&x_delim_char=%2C&x_encap_char=%22&x_relay_response=false&x_first_name=John&x_last_name=Doe&x_company=&x_address=10+Dev+Null+St&x_city=Dev+Null&x_state=California&x_zip=90000&x_country=United+States&x_phone=8884445555&x_customer_ip=XXX&x_email=johndoe%40dev.null&x_description=XXX&x_amount=6.44&x_currency_code=USD&x_method=CC&x_type=AUTH_CAPTURE&x_card_num=4007000000027&x_exp_date=042013&x_card_code=123&x_invoice_num=17
BACK FROM ANET:
3,1,103,This transaction cannot be accepted.,,P,0,,,0.00,,auth_capture,,,,,,,,,,,,,,,,,,,,,,,,,,XXX,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,XXX,3.1,true,,,",false,John,Doe,,10 Dev Null St,Dev Null,California,90000,United States,8884445555,XXX,johndoe@dev.null,SuperUltralightBackpacking.com,6.44,USD,CC,AUTH_CAPTURE,4007000000027,042013,123,17
3 means processing error and 103 means tran_key no good, which is absolutely NOT the case. It's something else, I just can't figure it out. I've tried on my LIVE account (not sandbox, not test, and with my LIVE versions of login_id and tran_key) with a real CC and it did exactly the same.
Hopefully someone can help, because I'm sitting on new inventory that I need to move!
03-27-2012 07:03 PM
Error 103 with AIM would be bad login ID or transaction key. You'd be surprised how many people mess those up and think they haven't. I even did that myself once. Did you try generating a new transaction key?
03-28-2012 12:13 AM
Hi TJ,
Thank you for the reply, but everything you mentioned was already covered in my post. I've heard that if you are using a domain name that hasn't AIM'd to the gateway before sometimes you have to reset the login_id as well? Do you think that could be it?
Did you see anything in the query strings I posted that could be the issue?
As I mentioned, I has a live and sandbox acct and have fresh trans keys. Sorry, but I'm not that bad at copy pasting. Plus I have another domain that is AIMing just fine to my live gateway.
03-28-2012 09:42 AM
After 48 grueling hours of debugging, I found and resolved the issue.
The problem is LINE 103 in OPENCART:
/catalog/controller/payment/authorizenet_aim.php
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
Per PHP manual commenter:
http://www.php.net/manual/en/function.http-build-query.php#102324
You need to explicitly add the arg separater with http_build_query!
So to fix OpenCart's AIM all you need to do is change LINE 103 to:
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data, '', '&'));
And you'll be good to go. I truly hope this helps someone, because it was a huge pain in the *&@ to figure out.
03-28-2012 11:14 AM