PHP Authorize.net AIM Interfacing Class

April 19, 2005
Provides a simplified interface the the authorize.net AIM payment gateway. Allows all the control and flexibility to be in the hands of the PHP developer (you). Uses cURL and SSL. The zip file includes the class to interface with authorize.net as well as a demonstration script on using the file.

Download:
Download Authorize.net PHP Script authorizenet-1.0.1.zip

Do you like this code? Rate This Script at Hot Scripts.
If you enjoy this free PHP script and want to show your support, you can throw me a couple of bucks using paypal. Any donation, even just a buck, is always appreciated.
Version History
  • v1.0.1 [01.19.2006] - Fixed urlencode glitch (finally)
  • v1.0.0 [04.07.2005] - Initial Version
Categories: Web Development

28 Comments about "PHP Authorize.net AIM Interfacing Class"

Wes
June 8, 2010 at 10:03 AM
I modified a few functions in the class to enable easy x_line_item adds for the transaction:

original:
function add_field($field, $value) {
$this->fields["$field"] = $value;
}
modified:
function add_field($field, $value) {
if ($field=="x_line_item") {
$this->line_items[] = $value;
} else {
$this->fields["$field"] = $value;
}
}

and in function process(), add second foreach for line_items array:
// construct the fields string to pass to authorize.net
foreach( $this->fields as $key => $value )
$this->field_string .= "$key=".urlencode( $value )."&";
foreach ($this->line_items as $value)
$this->field_string .= "x_line_item=".urlencode($value)."&";



Hope this might help anyone else wanting to use line items.
June 1, 2010 at 08:50 PM
hi, thank you for this latest information. Therefore, I would like to ask for your permission to add some of this information in my blog. Of course, I will provide a link to your blog, as a source of my quoted information.
November 18, 2009 at 03:50 PM
Authorize.net has adocument named AIM_Guide.pdf that lists all of the required ARB settings.
November 13, 2009 at 09:44 AM
nice nice nice, this is a great easy to use class, along with the provided demo file.

i dropped it in place and got approval on my first test transaction the first time i submitted it.

many thx Micah
Kenvin Johnson
May 14, 2009 at 09:49 PM
This is result which I got:


Success:
(TESTMODE) This transaction has been approved.


0 Response Code 1
1 Response Subcode 1
2 Response Reason Code 1
3 Response Reason Text (TESTMODE) This transaction has been approved.
4 Approval Code 000000
5 AVS Result Code P
6 Transaction ID 0
7 Invoice Number
8 Description
9 Amount 10.00
10 Method CC
11 Transaction Type auth_capture
12 Customer ID
13 Cardholder First Name xxx
14 Cardholder Last Name xxx
15 Company
16 Billing Address xxx
17 City xxxx
18 State xxx
19 Zip xxx
20 Country US
21 Phone xxx
22 Fax
23 Email someone@somedomain.com

37 MD5 Hash AEBCFED5EAB80D363DF8D5588B4245BE
68 Merchant Defined Field 0 FALSE
Kenvin Johnson
May 14, 2009 at 09:21 PM
Do I just need to change all these information???

$a->add_field('x_login', 'xxx');
$a->add_field('x_tran_key', 'xxx');


$a->add_field('x_first_name', 'xx');
$a->add_field('x_last_name', 'xx');
$a->add_field('x_address', 'xx');
$a->add_field('x_city', 'xx');
$a->add_field('x_state', 'TX');
$a->add_field('x_zip', 'xx');
$a->add_field('x_country', 'US');
$a->add_field('x_email', 'someone@somedomain.com');
$a->add_field('x_phone', 'xxx-xxx-xxxx');


$a->add_field('x_card_num', 'xxxxxxxxx'); // test successful visa

$a->add_field('x_amount', '10.00');
$a->add_field('x_exp_date', '0411'); // march of 2008
$a->add_field('x_card_code', 'xxx'); // Card CAVV Security code


And I get the result:

Success:
(TESTMODE) This transaction has been approved.

How do I know whether the credit card is valid or not?
Can you tell me more?

Thanks alot
Girish
March 3, 2009 at 03:55 AM
Hi,

I have used your authorize.net class. I m getting "Error with Transaction:" i.e. Case 3 error. Please help me.


Thanks
January 7, 2009 at 07:37 AM
Change $gateway_url in authorize.class.php to the following if you are using a test (development) account.

https://test.authorize.net/gateway/transact.dll
January 7, 2009 at 07:29 AM
If you are testing with a self-signed CA cert add the following to the process() function in the CURL block.

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);

This will bypass certificate verification.
December 27, 2008 at 07:40 AM
Hi Micah ,

Thanks for your authorize.net integration support. Do you have any Googlecheckout(IPN) classes in php and mysql? if so, please help me.

With Best Regards
September 12, 2008 at 11:36 PM
After turning off the dump fields, I get a blank screen. Although the script still works. How would I output only the accepted, declined or errored without showing all the rest of the responses.

Thanks
Kalpesh Gamir
August 11, 2008 at 12:34 AM
thansk this script very nice
Aktar
July 23, 2008 at 06:16 AM
Would you give me any or your ARB recurring payments link ?
It would be great if ARB code is your .
Thanks
Aktar
July 23, 2008 at 06:08 AM
Great Job !!!

This one is the best than other and thanks .
July 14, 2008 at 12:22 PM
@Mike: Wrong AIM, but thanks.

@Anthony: It looks like the ARB stuff is done a different way (SOAP or XML) so I'm guessing that this won't work for those. More info: http://developer.authorize.net/guides/
June 24, 2008 at 08:08 AM
Hit here nice class and thanks! just wondering does it support reaacurring billing ? (monthly payments etc..) thanks allot
Mike
June 21, 2008 at 11:47 AM
i'm using this to communicate with aim and icq http://thinker.rubay.de/archives/20-PHPurple-v0.2-alpha-released.html
May 15, 2008 at 05:25 AM
[...] Micah Carrick - Authorize.net AIM Interface using CURL [...]
Haider
May 7, 2008 at 12:05 AM
Hi Boss,

I am facing one issue by using ur class...the issues is that i have turn off the test mode on authorize.net but i am still receiving test mode email....why is this happening????....is there any issue in the class or what else???

Kindly Reply
Regards,
Haider
Samantha Davis
April 30, 2008 at 09:43 AM
I noticed this was posted several years ago, does it still work with the current authorize.net? Thanks!
March 26, 2008 at 07:54 AM
Mike: I don't actually know, though I would assume. I left it basic and simple so that you could use it for anything available so long as you know what variables to pass on.

Chetan: Yes, you will most likely be able to use the script. HTTP and SSL are sort of different things. As long as the PHP version you have has the CURL module installed you should be okay.
March 26, 2008 at 01:40 AM
If my site is http then this class will work? I dont know what is ssl.

So,like paypal ipn, it will work for my site also?
Mike
March 13, 2008 at 08:31 PM
Can this be used for ARB recurring payments? Great job.
February 11, 2008 at 01:14 PM
thansk this script very nice
albert
January 31, 2008 at 01:06 PM
thanks man...nice job...
January 10, 2008 at 07:55 AM
Your class does not appear to calculate or compare the md5 hash the AIM interface provides. Doing so would improve the security of your class and the transactions it handles.
September 29, 2007 at 12:36 PM
Thank you. It has been re-uploaded.
Uthman
September 29, 2007 at 12:06 PM
i believe your .zip file corrupt =X

Leave a Comment about "PHP Authorize.net AIM Interfacing Class"

Your Name:
(Required)
Website URL:
(Optional)
Comment:
(No HTML. Newlines and URLs okay.)
Enter CAPTCHA:
 
 
 
 
Share