admc-authnet, Java API for Authorize.net

Purpose

Any Java application... standalone, web app, other... can make real-time credit card purchases with Authorize.net.  This is for applications which want to control all user interaction and presentation (as opposed to sending the user off to some other site's purchase forms), and where the app developer can either copy and paste sample Java code, or work from a simple Java API spec.

Requirements

  1. Java 1.5 or later.
  2. An Authorize.net merchant account.  You must know the primary account name, and settings which you can obtain from Authorize.net's web console.

Sources

  1. Binary distribution at http://pub.admc.com/oss-products/admc-authnet/admc-authnet-2.0.zip.
  2. API spec available online at http://pub.admc.com/oss-products/admc-authnet/apispec/. If you want a local copy, download the source distribution and build the "api" target with Ant.
  3. Source distribution at http://pub.admc.com/oss-products/admc-authnet/admc-authnet-2.0-src.zip.

It's important that you verify these packages haven't been hacked, or somebody could gain access to both your Authorize.net account, and your customers' credit cards.

md5 checksum
file
545fe87d2a0c0f4b31fe2c2a2e09d324 http://pub.admc.com/oss-products/admc-authnet/admc-authnet-2.0.zip
eef563b30d5cb298a71a2e24f3be7ed3 http://pub.admc.com/oss-products/admc-authnet/admc-authnet-2.0-src.zip

How To Use

  1. Download the binary distribution and extract it.
  2. In the base directory created when you extracted the zip file, copy file authnet-template.properties to authnet.properties and edit it to reflect your Authorize.net account settings.
  3. Run some fake transactions manually using admc-authnet.  Make sure that request.test in authnet.properties} is set to true, and run {{ java -jar path/to/admc-authnet.jar}}.  That will report back with the syntax (you run the same exact command again, with arguments specifying the amount to charge, credit card number and expiration date).  Be aware that parameters typed on the command-line may be observed by others.  Your real app will not have this security risk.
  4. You can also turn off the request.test setting and put test transactions through by using the fake credit card numbers (which numbers are specified in your Authorize.net documentation).  IIRC, you can toggle the Authorize.net account itself to run in test mode, and run admc-authnet.jar exactly as if it were a real transaction.  This last will not work if anybody else, or any other app, needs to submit real transactions at the same time.
  5. Either
    1. Copy the method com.admc.authnet.AimTransaction.main to your own class, expanding and enhancing it according to the API Spec.
    2. Code your Java directly from the API Spec. Instantiate a singleton com.admc.authnet.AimConfig object for your application (only need more than one if you want to use multiple configurations for your one application). Create an AimTransaction object each time you want to submit a credit card transaction to Authorize.net. You will need to use the setters for at least Amount, CardNum and Exp (expiration date), then the submit method.
  6. The supplied AimTransaction.validateInput method can be used when appropriate. It can lower your bills and improve your relationships with Authorize.net and banks if you filter out bad transactions before submitting them.
  7. After the credit card is successfully charged, you will want to record that fact somewhere.  You can use the getter methods of the AimTransaction bean and do whatever you want, or you can use the AimTransaction.Persistor interface to have admc-authnet pass just the key transaction details to your own method.
  8. The AimTransaction object will be garbage collected when you are finished with it (so don't leave any pointers to it). 

Support

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.