Authorize.Net Ruby SDK

The Authorize.Net Ruby SDK is meant to offer an alternate object-oriented model of development with the Authorize.net APIs (Version 3.1). The SDK is based entirely off the name-value pair API, but performs the core payment activities (such as error handling/parsing, network communication, and data encoding) behind the scenes. Providing the end developer with this allows the developer to start integrating immediately without having to write out a mass of boiler plate code.

Prerequisites

Installation

Goto the Authorize.Net SDK download page and download the Ruby gem. Then

> gem install authorize-net-1.0.0.gem

Usage

A generator is provided to aid in setting up a Direct Post Method application. In the example below 'payments' is the name of the controller to generate.

> sudo gem install rails -v '~> 2.1'
> rails my_direct_post_app
> cd my_direct_post_app
> script/generate authorize_net_direct_post payments YOUR_API_LOGIN_ID YOUR_TRANSACTION_KEY MERCH_HASH_KEY
> script/server

After running the generator you will probably want to customize the payment form found in 'app/views/payments/payment.erb' and the receipt found in 'app/views/payments/receipt.erb'.

There is also a default layout generated, 'app/views/layouts/authorize_net.erb'. If you already have your own layout, you can delete that file and the reference to it in the controller ('app/controllers/payments_controller.rb').

Credit Card Test Numbers

For your reference, you can use the following test credit card numbers. The expiration date must be set to the present date or later. Use 123 for the CCV code.

American Express

370000000000002

Discover

6011000000000012

Visa

4007000000027

JCB

3088000000000017

Diners Club/ Carte Blanche

38000000000006