
Untitled
By: a guest on
Sep 21st, 2012 | syntax:
None | size: 1.05 KB | hits: 18 | expires: Never
require 'rubygems'
require 'active_merchant'
#= Elavon Virtual Merchant Gateway
#== Example use:
ActiveMerchant::Billing::Base.mode = :test
gateway = ActiveMerchant::Billing::ElavonGateway.new(
:login => "123456",#my_virtual_merchant_id
:password => "ABCDEF",#my_virtual_merchant_pin
:user => "123456" # optional,my_virtual_merchant_user_id
)
# set up credit card obj as in main ActiveMerchant example
creditcard = ActiveMerchant::Billing::CreditCard.new(
:brand => 'visa',
:number => '4111111111111111',
:month => 12,
:year => 2013,
:first_name => 'Bob',
:last_name => 'Bobsen',
:verification_value => '123'
)
options = {
:billing_address => {
:address1 => '123 rails road',
:zip => '91234'
},
:email => 'a@aa.com',
:test_mode => false
}
# run request
response = gateway.purchase(1000, creditcard, options) # authorize and capture 10 USD
puts response.success? # Check whether the transaction was successful
puts response.message # Retrieve the message returned by Elavon
puts response.authorization # Retrieve the unique transaction ID returned by Elavon