Fat Zebra support for Active Merchant, extracted into an add-on gem
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
ActiveMerchant-FatZebra.gemspec
Gemfile
README.md
Rakefile

README.md

FatZebra ActiveMerchant integration

The quick 30-second rundown

  1. Install the gem in your Gemfile

    gem "ActiveMerchant-FatZebra"

Then bundle install

  1. Setup the gateway in your app:
options = {
  :username => "TEST",
  :token    => "TEST"
}
gateway = ActiveMerchant::Billing::FatZebraGateway.new(options)

# If you are testing, uncomment the following line
# ActiveMerchant::Billing::Base.gateway_mode = :test
  1. Setup the transaction data and then... transact!
cc = ActiveMerchant::Billing::CreditCard.new(:first_name => "Joe", 
											 :last_name => "Smith",
											 :number => "5123456789012346",
											 :month => 12,
											 :year => 2013,
											 :verification_value => 123)

amount = 10000 # 100.00 in cents

result = gateway.purchase(amount, cc, { :order_id => "ORD18239", :ip => request.ip })

A list of test credit card numbers can be found at https://www.fatzebra.com.au/help/testing#card-numbers.

  1. Handle the response - the data you get back is:
result.success? # True or False depending on if the txn was successful
result.message # e.g. "Approved" or "Declined"
result.authorization # The transaction ID
result.test? # Indicates if this was a test transaction
result.params # Parameters passed by the gateway (e.g. may be additional info like fraud review score.)
result.params["result"]["id"] # The transaction ID
result.params["result"]["authorization"] # The acquirer authorization ID
result.params["result"]["token"] # The card token (when storing a card)

Refunds

# Refunding the amount of $100.00, for the original transaction ID of "AB12887Z"
response = gateway.refund(10000, "AB12887Z", "REFUND1")

response.success? # true or false