Class: ActiveMerchant::Billing::BeanstreamGateway

### Home Classes Methods

### In Files

- lib/active_merchant/billing/gateways/beanstream.rb

### Parent

ActiveMerchant::Billing::Gateway

### Methods

- #authorize
- #delete
- #interac
- #purchase
- #store
- #unstore
- #update
- #void

### Included Modules

- BeanstreamCore

### Class/Module Index

Quicksearch

- ActiveMerchant
- ActiveMerchant::Billing
- ActiveMerchant::Billing::AVSResult
- ActiveMerchant::Billing::BarclaysEpdqGateway
- ActiveMerchant::Billing::BarclaysEpdqGateway::Document
- ActiveMerchant::Billing::BarclaysEpdqGateway::Parser
- ActiveMerchant::Billing::Base
- ActiveMerchant::Billing::BeanstreamGateway
- ActiveMerchant::Billing::BeanstreamInteracGateway
- ActiveMerchant::Billing::BeanstreamInteracResponse
- ActiveMerchant::Billing::BluePayGateway
- ActiveMerchant::Billing::BogusGateway
- ActiveMerchant::Billing::BraintreeBlueGateway
- ActiveMerchant::Billing::BraintreeGateway
- ActiveMerchant::Billing::BraintreeOrangeGateway
- ActiveMerchant::Billing::CVVResult
- ActiveMerchant::Billing::CardSaveGateway
- ActiveMerchant::Billing::CardStreamGateway
- ActiveMerchant::Billing::Check
- ActiveMerchant::Billing::CreditCard
- ActiveMerchant::Billing::CreditCardFormatting
- ActiveMerchant::Billing::CreditCardMethods
- ActiveMerchant::Billing::CreditCardMethods::ClassMethods
- ActiveMerchant::Billing::CyberSourceGateway
- ActiveMerchant::Billing::DataCashGateway
- ActiveMerchant::Billing::EfsnetGateway
- ActiveMerchant::Billing::ElavonGateway
- ActiveMerchant::Billing::EpayGateway
- ActiveMerchant::Billing::EwayGateway
- ActiveMerchant::Billing::EwayManagedGateway
- ActiveMerchant::Billing::EwayManagedGateway::EwayResponse
- ActiveMerchant::Billing::ExactGateway
- ActiveMerchant::Billing::FederatedCanadaGateway
- ActiveMerchant::Billing::FirstPayGateway
- ActiveMerchant::Billing::FirstPayGateway::FirstPayPostData
- ActiveMerchant::Billing::GarantiGateway
- ActiveMerchant::Billing::Gateway
- ActiveMerchant::Billing::IdealBaseGateway
- ActiveMerchant::Billing::IdealRabobankGateway
- ActiveMerchant::Billing::IdealResponse
- ActiveMerchant::Billing::InspireGateway
- ActiveMerchant::Billing::InstapayGateway
- ActiveMerchant::Billing::Integrations
- ActiveMerchant::Billing::Integrations::ActionViewHelper
- ActiveMerchant::Billing::Integrations::Bogus
- ActiveMerchant::Billing::Integrations::Bogus::Helper
- ActiveMerchant::Billing::Integrations::Bogus::Notification
- ActiveMerchant::Billing::Integrations::Bogus::Return
- ActiveMerchant::Billing::Integrations::Chronopay
- ActiveMerchant::Billing::Integrations::Chronopay::Helper
- ActiveMerchant::Billing::Integrations::Chronopay::Return
- ActiveMerchant::Billing::Integrations::DirecPay
- ActiveMerchant::Billing::Integrations::DirecPay::Helper
- ActiveMerchant::Billing::Integrations::DirecPay::Notification
- ActiveMerchant::Billing::Integrations::DirecPay::Return
- ActiveMerchant::Billing::Integrations::DirecPay::Status
- ActiveMerchant::Billing::Integrations::Directebanking
- ActiveMerchant::Billing::Integrations::Directebanking::Helper
- ActiveMerchant::Billing::Integrations::Directebanking::Notification
- ActiveMerchant::Billing::Integrations::Directebanking::Return
- ActiveMerchant::Billing::Integrations::Dwolla
- ActiveMerchant::Billing::Integrations::Dwolla::Helper
- ActiveMerchant::Billing::Integrations::Dwolla::Notification
- ActiveMerchant::Billing::Integrations::Dwolla::Return
- ActiveMerchant::Billing::Integrations::EPaymentPlans
- ActiveMerchant::Billing::Integrations::EPaymentPlans::Helper
- ActiveMerchant::Billing::Integrations::EPaymentPlans::Notification
- ActiveMerchant::Billing::Integrations::Gestpay
- ActiveMerchant::Billing::Integrations::Gestpay::Common
- ActiveMerchant::Billing::Integrations::Gestpay::Helper
- ActiveMerchant::Billing::Integrations::Gestpay::Notification
- ActiveMerchant::Billing::Integrations::Gestpay::Return
- ActiveMerchant::Billing::Integrations::HiTrust
- ActiveMerchant::Billing::Integrations::HiTrust::Notification
- ActiveMerchant::Billing::Integrations::HiTrust::Return
- ActiveMerchant::Billing::Integrations::Moneybookers
- ActiveMerchant::Billing::Integrations::Moneybookers::Helper
- ActiveMerchant::Billing::Integrations::Nochex
- ActiveMerchant::Billing::Integrations::Nochex::Helper
- ActiveMerchant::Billing::Integrations::Nochex::Notification
- ActiveMerchant::Billing::Integrations::Nochex::Return
- ActiveMerchant::Billing::Integrations::Notification
- ActiveMerchant::Billing::Integrations::PayflowLink
- ActiveMerchant::Billing::Integrations::PayflowLink::Helper
- ActiveMerchant::Billing::Integrations::PayflowLink::Notification
- ActiveMerchant::Billing::Integrations::Paypal
- ActiveMerchant::Billing::Integrations::Paypal::Helper
- ActiveMerchant::Billing::Integrations::Paypal::Notification
- ActiveMerchant::Billing::Integrations::Paypal::Return
- ActiveMerchant::Billing::Integrations::Quickpay
- ActiveMerchant::Billing::Integrations::Quickpay::Helper
- ActiveMerchant::Billing::Integrations::Quickpay::Notification
- ActiveMerchant::Billing::Integrations::Return
- ActiveMerchant::Billing::Integrations::SagePayForm
- ActiveMerchant::Billing::Integrations::SagePayForm::Encryption
- ActiveMerchant::Billing::Integrations::SagePayForm::Helper
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification::CryptError
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification::InvalidCryptData
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification::MissingCryptData
- ActiveMerchant::Billing::Integrations::SagePayForm::Notification::MissingCryptKey
- ActiveMerchant::Billing::Integrations::SagePayForm::Return
- ActiveMerchant::Billing::Integrations::TwoCheckout
- ActiveMerchant::Billing::Integrations::TwoCheckout::Helper
- ActiveMerchant::Billing::Integrations::TwoCheckout::Notification
- ActiveMerchant::Billing::Integrations::TwoCheckout::Return
- ActiveMerchant::Billing::Integrations::Valitor
- ActiveMerchant::Billing::Integrations::Valitor::Helper
- ActiveMerchant::Billing::Integrations::Valitor::Notification
- ActiveMerchant::Billing::Integrations::Valitor::ResponseFields
- ActiveMerchant::Billing::Integrations::Valitor::Return
- ActiveMerchant::Billing::Integrations::WorldPay
- ActiveMerchant::Billing::Integrations::WorldPay::Helper
- ActiveMerchant::Billing::Integrations::WorldPay::Notification
- ActiveMerchant::Billing::IridiumGateway
- ActiveMerchant::Billing::JetpayGateway
- ActiveMerchant::Billing::LinkpointGateway
- ActiveMerchant::Billing::MerchantESolutionsGateway
- ActiveMerchant::Billing::MerchantWareGateway
- ActiveMerchant::Billing::ModernPaymentsGateway
- ActiveMerchant::Billing::MonerisGateway
- ActiveMerchant::Billing::NetRegistryGateway
- ActiveMerchant::Billing::NetaxeptGateway
- ActiveMerchant::Billing::NetaxeptGateway::Response
- ActiveMerchant::Billing::NetbillingGateway
- ActiveMerchant::Billing::NmiGateway
- ActiveMerchant::Billing::OptimalPaymentGateway
- ActiveMerchant::Billing::OrbitalSoftDescriptors
- ActiveMerchant::Billing::PayJunctionGateway
- ActiveMerchant::Billing::PaySecureGateway
- ActiveMerchant::Billing::PayboxDirectGateway
- ActiveMerchant::Billing::PayflowCommonAPI
- ActiveMerchant::Billing::PayflowExpressResponse
- ActiveMerchant::Billing::PayflowExpressUkGateway
- ActiveMerchant::Billing::PayflowGateway
- ActiveMerchant::Billing::PayflowResponse
- ActiveMerchant::Billing::PayflowUkGateway
- ActiveMerchant::Billing::PaymentExpressGateway
- ActiveMerchant::Billing::PaymentExpressResponse
- ActiveMerchant::Billing::PaypalCaGateway
- ActiveMerchant::Billing::PaypalCommonAPI
- ActiveMerchant::Billing::PaypalExpressCommon
- ActiveMerchant::Billing::PaypalExpressGateway
- ActiveMerchant::Billing::PaypalExpressResponse
- ActiveMerchant::Billing::PaypalGateway
- ActiveMerchant::Billing::PlugnpayGateway
- ActiveMerchant::Billing::PlugnpayGateway::PlugnpayPostData
- ActiveMerchant::Billing::PsigateGateway
- ActiveMerchant::Billing::QbmsGateway
- ActiveMerchant::Billing::QuantumGateway
- ActiveMerchant::Billing::QuickpayGateway
- ActiveMerchant::Billing::RealexGateway
- ActiveMerchant::Billing::Response
- ActiveMerchant::Billing::SageGateway
- ActiveMerchant::Billing::SagePayGateway
- ActiveMerchant::Billing::SallieMaeGateway
- ActiveMerchant::Billing::SamuraiGateway
- ActiveMerchant::Billing::SecureNetGateway
- ActiveMerchant::Billing::SecurePayAuGateway
- ActiveMerchant::Billing::SecurePayGateway
- ActiveMerchant::Billing::SecurePayTechGateway
- ActiveMerchant::Billing::SecurePayTechGateway::SecurePayTechPostData
- ActiveMerchant::Billing::SkipJackGateway
- ActiveMerchant::Billing::StripeGateway
- ActiveMerchant::Billing::TransFirstGateway
- ActiveMerchant::Billing::TransaxGateway
- ActiveMerchant::Billing::TrustCommerceGateway
- ActiveMerchant::Billing::UsaEpayAdvancedGateway
- ActiveMerchant::Billing::UsaEpayGateway
- ActiveMerchant::Billing::UsaEpayTransactionGateway
- ActiveMerchant::Billing::VerifiGateway
- ActiveMerchant::Billing::VerifiGateway::VerifiPostData
- ActiveMerchant::Billing::ViaklixGateway
- ActiveMerchant::Billing::WirecardGateway
- ActiveMerchant::Billing::WorldpayGateway
- ActiveMerchant::Billing::WorldpayGateway::MultiResponse
- BraintreeCommon
- OutboundHosts

No matching classes.

# ActiveMerchant::Billing::BeanstreamGateway

This class implements the Canadian Beanstream payment gateway. It is also named TD Canada Trust Online Mart payment gateway. To learn more about the specification of Beanstream gateway, please read the OM_Direct_Interface_API.pdf, which you can get from your Beanstream account or get from me by email.

## Supported transaction types by Beanstream:

- `P` - Purchase

- `PA` - Pre Authorization

- `PAC` - Pre Authorization Completion

## Secure Payment Profiles:

BeanStream supports payment profiles (vaults). This allows you to store cc information with BeanStream and process subsequent transactions with a customer id. Secure Payment Profiles must be enabled on your account (must be done over the phone). Your API Access Passcode must be set in Administration => account settings => order settings. To learn more about storing credit cards with the Beanstream gateway, please read the BEAN_Payment_Profiles.pdf (I had to phone BeanStream to request it.)

## Notes

- Recurring billing is not yet implemented.

- Adding of order products information is not implemented.

- Ensure that country and province data is provided as a code such as "CA", "US", "QC".

- login is the Beanstream merchant ID, username and password should be enabled in your Beanstream account and passed in using the `:user` and `:password` options.

- Test your app with your true merchant id and test credit card information provided in the api pdf document.

- Beanstream does not allow Payment Profiles to be deleted with their API. The accounts are 'closed', but have to be deleted manually.

    Example authorization (Beanstream PA transaction type):

     twenty = 2000
     gateway = BeanstreamGateway.new(
       :login => '100200000',
       :user => 'xiaobozz',
       :password => 'password'
     )

     credit_card = CreditCard.new(
       :number => '4030000010001234',
       :month => 8,
       :year => 2011,
       :first_name => 'xiaobo',
       :last_name => 'zzz',
       :verification_value => 137
     )
     response = gateway.authorize(twenty, credit_card,
       :order_id => '1234',
       :billing_address => {
         :name => 'xiaobo zzz',
         :phone => '555-555-5555',
         :address1 => '1234 Levesque St.',
         :address2 => 'Apt B',
         :city => 'Montreal',
         :state => 'QC',
         :country => 'CA',
         :zip => 'H2C1X8'
       },
       :email => 'xiaobozzz@example.com',
       :subtotal => 800,
       :shipping => 100,
       :tax1 => 100,
       :tax2 => 100,
       :custom => 'reference one'
     )

### Public Instance Methods

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

    # File lib/active_merchant/billing/gateways/beanstream.rb, line 68
    def authorize(money, source, options = {})
      post = {}
      add_amount(post, money)
      add_invoice(post, options)
      add_source(post, source)
      add_address(post, options)
      add_transaction_type(post, :authorization)
      commit(post)
    end

delete(vault_id) click to toggle source

can't actually delete a secure profile with the supplicaed API. This function sets the status of the profile to closed (C). Closed profiles will have to removed manually.

    # File lib/active_merchant/billing/gateways/beanstream.rb, line 114
    def delete(vault_id)
      update(vault_id, false, {:status => "C"})
    end

Also aliased as: unstore
interac() click to toggle source

    # File lib/active_merchant/billing/gateways/beanstream.rb, line 98
    def interac
      @interac ||= BeanstreamInteracGateway.new(@options)
    end

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

    # File lib/active_merchant/billing/gateways/beanstream.rb, line 78
    def purchase(money, source, options = {})
      post = {}
      add_amount(post, money)
      add_invoice(post, options)
      add_source(post, source)
      add_address(post, options)
      add_transaction_type(post, purchase_action(source))
      commit(post)
    end

store(credit_card, options = {}) click to toggle source

To match the other stored-value gateways, like TrustCommerce, store and unstore need to be defined

    # File lib/active_merchant/billing/gateways/beanstream.rb, line 104
    def store(credit_card, options = {})
      post = {}
      add_address(post, options)
      add_credit_card(post, credit_card)
      add_secure_profile_variables(post,options)
      commit(post, true)
    end

unstore(vault_id) click to toggle source
Alias for: delete
update(vault_id, credit_card, options = {}) click to toggle source

Update the values (such as CC expiration) stored at the gateway. The CC number must be supplied in the CreditCard object.

    # File lib/active_merchant/billing/gateways/beanstream.rb, line 123
    def update(vault_id, credit_card, options = {})
      post = {}
      add_address(post, options)
      add_credit_card(post, credit_card)
      options.merge!({:vault_id => vault_id, :operation => secure_profile_action(:modify)})
      add_secure_profile_variables(post,options)
      commit(post, true)
    end

void(authorization, options = {}) click to toggle source

    # File lib/active_merchant/billing/gateways/beanstream.rb, line 88
    def void(authorization, options = {})
      reference, amount, type = split_auth(authorization)

      post = {}
      add_reference(post, reference)
      add_original_amount(post, amount)
      add_transaction_type(post, void_action(type))
      commit(post)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.