This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
GettingStarted
Using AM is fairly straightforward, and the RDOC is fairly comprehensive, however, the following quickstart guide may be helpful.
First note that AM is (mostly) unrelated to Rails, it’s a payment interface and your application needs to handle the actual collection of customer details and the whole order process. AM will only help you with interfacing to the payment gateway and taking payments (and interpreting the gateway reply)
OK, so assuming you have built some application which has somehow captured the customers billing details and credit card info, a simple example to bill that customer would be as follows:
require 'active_merchant'
amount=1000 #$10.00 in cents
LOGIN_ID = 'your_login_id_here'
TRANSACTION_KEY = 'your_trans_key_here'
ActiveMerchant::Billing::Base.mode = :test
#number = '4222222222222' #Authorize.net test card, error-producing
number = '4007000000027' #Authorize.net test card, non-error-producing
billing_address = { :name => 'Bob Smith', :address1 => '123 Down the Road',
:city => 'San Francisco', :state => 'CA',
:country => 'US', :zip => '23456', :phone => '(555)555-5555' }
credit_card = ActiveMerchant::Billing::CreditCard.new(
:number => number,
:month => 10,
:year => 2010,
:first_name => 'Bob',
:last_name => 'Smith',
:verification_value => '111', #verification codes are now required
:type => 'visa'
)
if credit_card.valid?
gateway = ActiveMerchant::Billing::AuthorizeNetGateway.new(
:login => LOGIN_ID,
:password => TRANSACTION_KEY
)
options = {:address => {}, :billing_address => billing_address}
response = gateway.purchase(charge_amount, credit_card, options)
if response.success?
puts "success!"
else
raise StandardError.new( response.message )
end
end #missing end to if creditcard.valid?
Some useful URLs:
http://www.codyfauser.com/2008/1/17/paypal-express-payments-with-activemerchant






