Parent

Class/Module Index [+]

Quicksearch

ActiveMerchant::Billing::ElavonGateway

Elavon Virtual Merchant Gateway

Example use:

gateway = ActiveMerchant::Billing::ElavonGateway.new(
            :login     => "my_virtual_merchant_id",
            :password  => "my_virtual_merchant_pin",
            :user      => "my_virtual_merchant_user_id" # optional
         )

# set up credit card obj as in main ActiveMerchant example
creditcard = ActiveMerchant::Billing::CreditCard.new(
  :type       => 'visa',
  :number     => '41111111111111111',
  :month      => 10,
  :year       => 2011,
  :first_name => 'Bob',
  :last_name  => 'Bobsen'
)

# run request
response = gateway.purchase(1000, creditcard) # 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

Public Instance Methods

authorize(money, creditcard, options = {}) click to toggle source

Authorize a credit card for a given amount.

Parameters

  • money - The amount to be authorized as an Integer value in cents.

  • credit_card - The CreditCard details for the transaction.

  • options

    • :billing_address - The billing address for the cardholder.

# File lib/active_merchant/billing/gateways/elavon.rb, line 56
def authorize(money, creditcard, options = {})
  form = {}
  add_invoice(form, options)
  add_creditcard(form, creditcard)        
  add_address(form, options)   
  add_customer_data(form, options)
  commit(:authorize, money, form)
end
capture(money, authorization, options = {}) click to toggle source

Capture authorized funds from a credit card.

Parameters

  • money - The amount to be captured as an Integer value in cents.

  • authorization - The approval code returned from the initial authorization.

  • options

    • :credit_card - The CreditCard details from the initial transaction (required).

# File lib/active_merchant/billing/gateways/elavon.rb, line 72
def capture(money, authorization, options = {})
  requires!(options, :credit_card)
  
  form = {}
  add_reference(form, authorization)
  add_invoice(form, options)
  add_creditcard(form, options[:credit_card])
  add_customer_data(form, options)
  commit(:capture, money, form)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.