Author: Jim Conners
Rating: 10.0
Since this article is about integrating the Authorize.Net payment gateway into an ecommerce application, it stands to reason that we would have some basic requirements concerning it. Authorize.Net provides developers a set of tools to assist with the integration of their software. Utilizing these tools will make our job easier and less prone to error.
Naturally it is very difficult to develop any application without having all of the necessary components available for testing. A web developer who is integrating the Authorize.Net gateway into an existing merchant account can use their instance of the merchant's gateway and turn on test mode to test their application. But if you are a web developer who is developing your own software that will need to integrate with Authorize.Net gateway, like a shopping cart, or wish to get into the ecommerce development arena, you will not have an Authorize.Net account to test your code on.
Fortunately the developers at Authorize.Net had the foresight to understand that not every developer will have an Authorize.Net account to test on and will not want to wait until they have a customer to start writing their code. (Plus having a testing environment available for developers allows more applications to be certified thus potentially growing their marketshare). For these developers Authorize.Net has a system in place for allowing developers to have fully functional test accounts to test their integration code.
You can request a test account by going to http://developer.authorize.net/testaccount/ and completing their short application. It takes about one business day to receive your account credentials which is why I recommend doing this step first. While you wait you can start writing your code using what can be found on step 2…
While you wait for your test account credentials to be provided to you by Authorize.Net, you should download the documentation which explains how to communicate with their API. Their documentation is in pdf format and can be downloaded here: Advanced Integration Method Integration Guide. It offers a clear explanation of all of their API calls and should explain what you need to do to communicate successfully.
If reading boring documentation is not the best way for you learn, Authorize.Net offers yet another way to learn more about their API. You may request sample code to demonstrate how to connect successfully to their API. They offer sample code for ASP (VBScript), ASP.Net (Using C# or VB.NET), Cold Fusion, Java, Perl, and PHP. The code samples work so writing code to work with their API can be as simple as modifying their code.
The scope of this article, integrating the Authorize.Net payment gateway, provides us with a narrow topic on which to focus (which is a good thing). To keep this article focused on the topic at hand we will not delve into basic programming skills and techniques. Assumptions that are made in this article include:
It will be assumed that you have some basic PHP programming skills with basic to moderate programming experience. A basic part of any application which receives data from a user is to validate that data. This means ensuring that all required data is present as well is a value that is valid for that field. An example would be verifying that a zip code is actually a five digit number and not just "asdf". To keep the focus on implementing the Authorize.Net gateway it will be assumed that your application has already validated all of the user's input and that it is safe to use. However, we will cover validating credit card information as it does fall within the scope of this article.
If you are unfamiliar with validating data there are plenty of tutorials online. A couple of good ones are offered by HTML Center and Codewalkers.
Object Oriented Development (OOP) offers a developer an opportunity to create a modular application that features reusable code.
If you need to learn more about object oriented programming and design you should read An Introduction to Object-Oriented Design and also checkout WikiPedia's entry for Object-oriented programming.
Regular expressions are a common tool used by many programming languages for matching patterns in strings. Its use in data validation is essential as it can allow for very precise validation of user input. There are a few variations of regular express syntax. This article will use the most common and powerful version: the Perl Compatible Regular Expressions (PCRE). PCRE is used by the most common web development languages such as Perl, PHP, and Java. For a tutorial see PHP's page on PCRE Syntax and the WikiPedia Entry for regular expressions.
Introduction | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Planning the Transaction