Showing results for 
Search instead for 
Did you mean: 

Standard or Automatic?

I used to drive a stick shift.  I enjoyed the power and control of it, especially at certain times, like going up or down hills, driving in the rain, and a handful of other situations.  I haven’t driven a stick in years now, and while it was certainly more challenging, it had its benefits.


However, now I’m driving a car with an automatic transmission and it’s made my life a lot simpler.  Sure, I may not be as adept at getting out of the mud or snow, but I can rely on the car’s technology to decide when to shift gears.  I know it’s going to work, and I don’t need to know how it happens.  I just need to drive from A to B, and let the technology do what it does best.

Well, at Authorize.Net, the engine that has made payments work smoothly for years now has an optional layer on top of it, allowing for an easier learning curve and a simpler execution.  Over the past decade, Authorize.Net has gained the trust of developers by offering a consistently powerful set of payment APIs.  Now these APIs are even easier to use with the new open source SDKs available in many popular languages.

Today I’m talking about the PHP SDK. Are you running a PHP site? Do you want to add basic credit card processing that site? Or maybe advanced payment capabilities, like eChecks or subscriptions? Whatever your goals, the new PHP SDK gets you set up with both basics and the more advanced features all with less effort on your end.


Here, I’ll guide you through the simple process of going “automatic” with the PHP SDK.  If you have more of a “stick-shift personality” or your circumstances require more complete control, don’t fret; you always have the option of modifying this code or interfacing directly with the API.

Get It off the Lot

The open source PHP SDK is hosted at You can download a zip archive of the latest stable release. To use the SDK, save this archive to your computer and unzip it into a folder that you can reference from your web application. 

Take It for a Test Drive

To use the SDK, simply include the AuthorizeNet.php file, which is in the root directory of the zip archive you just downloaded.

Once you include this file, you have access to the whole SDK. It’s really that straightforward.  Now you are free to implement the API method you want.

For example, the following four lines of code will Authorize and Charge a test credit card $9.99 using the Advanced Integration Method (AIM):

   <code><?php include 'anet_php_sdk/AuthorizeNet.php';

       $response = $sale->authorizeAndCapture("9.99", '6011000000000012', '04/16');

It Comes With a Manual

The SDK includes a README which has examples of all of the APIs in action. The SDK also includes a "tests" folder which has test cases for each API. If you are trying to implement a common API method, chances are there is a similar test in this folder that you can use as a reference. You can also browse the documented source code for detailed information on using the SDK to interact with the APIs.

New Safety Features that Don’t Cramp Your Style

The new Authorize.Net integration method, Direct Post Method (DPM), allows for maximum flexibility along with drastically reduced PCI compliance issues. If you are interested in implementing this new Direct Post Method, a class is included in the SDK containing helper functions and examples to simplify your task. The DPM class includes a function for generating the fingerprint hash you'll need on your checkout form, another for generating a Javascript snippet for use on your relay response page, and a third which implements a complete working demonstration of the entire Direct Post Method.

Ideas for Improvement? Go for It!

The AuthorizeNet PHP SDK is an open source project.  Contributions and feedback are welcome and invited. Keep an eye on the PHP SDK page as new releases will be posted containing new features, bug fixes, and improved integration with existing and future Authorize.Net APIs.  Along the lines of my car analogy, you’re welcome to swap out the gears, belts, and moving parts as you see fit (modifying our source code), or even build an entirely different car if you like (interfacing directly with the API).

Getting Help

If you have problems, bugs, or suggestions, the best place to share these is right here as comments to the post or in the relevant forum thread in the Developer Community.  Meanwhile, enjoy the ride!  Time for me to head back to the garage!



Breck is a guest contributor for Authorize.Net

Guest Contributor