Skip to content

Fat Zebra support for Active Merchant, extracted into an add-on gem

Notifications You must be signed in to change notification settings

fatzebra/ActiveMerchant-FatZebra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Fat Zebra support for Active Merchant, extracted into an add-on gem

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages