Class: ActiveMerchant::Billing::AuthorizeNetArbGateway
- Defined in:
- lib/active_merchant/billing/gateways/authorize_net_arb.rb
Overview
For more information on the Authorize.Net Gateway please visit their Integration Center
The login and password are not the username and password you use to login to the Authorize.Net Merchant Interface. Instead, you will use the API Login ID as the login and Transaction Key as the password.
How to Get Your API Login ID and Transaction Key
-
Log into the Merchant Interface
-
Select Settings from the Main Menu
-
Click on API Login ID and Transaction Key in the Security section
-
Type in the answer to the secret question configured on setup
-
Click Submit
Automated Recurring Billing (ARB)
Automated Recurring Billing (ARB) is an optional service for submitting and managing recurring, or subscription-based, transactions.
To use recurring, update_recurring, cancel_recurring and status_recurring ARB must be enabled for your account.
Information about ARB is available on the Authorize.Net website. Information about the ARB API is available at the Authorize.Net Integration Center
Constant Summary collapse
- API_VERSION =
'3.1'
- AUTHORIZE_NET_ARB_NAMESPACE =
'AnetApi/xml/v1/schema/AnetApiSchema.xsd'
- RECURRING_ACTIONS =
{ :create => 'ARBCreateSubscription', :update => 'ARBUpdateSubscription', :cancel => 'ARBCancelSubscription', :status => 'ARBGetSubscriptionStatus' }
Constants inherited from Gateway
Gateway::CREDIT_DEPRECATION_MESSAGE, Gateway::RECURRING_DEPRECATION_MESSAGE, Gateway::STANDARD_ERROR_CODE
Instance Attribute Summary
Attributes inherited from Gateway
Instance Method Summary collapse
-
#cancel_recurring(subscription_id) ⇒ Object
Cancel a recurring payment.
-
#initialize(options = {}) ⇒ AuthorizeNetArbGateway
constructor
Creates a new AuthorizeNetArbGateway.
-
#recurring(money, creditcard, options = {}) ⇒ Object
Create a recurring payment.
-
#status_recurring(subscription_id) ⇒ Object
Get Subscription Status of a recurring payment.
-
#update_recurring(options = {}) ⇒ Object
Update a recurring payment’s details.
Methods inherited from Gateway
#add_field_to_post_if_present, #add_fields_to_post_if_present, #card_brand, card_brand, #generate_unique_id, inherited, #scrub, #supported_countries, supported_countries, supported_countries=, supports?, #supports_network_tokenization?, #supports_scrubbing?, #test?
Methods included from CreditCardFormatting
Methods included from PostsData
included, #raw_ssl_request, #ssl_get, #ssl_post, #ssl_request
Constructor Details
#initialize(options = {}) ⇒ AuthorizeNetArbGateway
Creates a new AuthorizeNetArbGateway
The gateway requires that a valid login and password be passed in the options
hash.
Options
-
:login
– The Authorize.Net API Login ID (REQUIRED) -
:password
– The Authorize.Net Transaction Key. (REQUIRED) -
:test
–true
orfalse
. If true, perform transactions against the test server. Otherwise, perform transactions against the production server.
59 60 61 62 63 |
# File 'lib/active_merchant/billing/gateways/authorize_net_arb.rb', line 59 def initialize( = {}) ActiveMerchant.deprecated 'ARB functionality in ActiveMerchant is deprecated and will be removed in a future version. Please contact the ActiveMerchant maintainers if you have an interest in taking ownership of a separate gem that continues support for it.' requires!(, :login, :password) super end |
Instance Method Details
#cancel_recurring(subscription_id) ⇒ Object
Cancel a recurring payment.
This transaction cancels an existing Automated Recurring Billing (ARB) subscription. Your account must have ARB enabled and the subscription must have already been created previously by calling recurring()
Parameters
-
subscription_id
– A string containing thesubscription_id
of the recurring payment already in place for a given credit card. (REQUIRED)
128 129 130 131 |
# File 'lib/active_merchant/billing/gateways/authorize_net_arb.rb', line 128 def cancel_recurring(subscription_id) request = build_recurring_request(:cancel, :subscription_id => subscription_id) recurring_commit(:cancel, request) end |
#recurring(money, creditcard, options = {}) ⇒ Object
Create a recurring payment.
This transaction creates a new Automated Recurring Billing (ARB) subscription. Your account must have ARB enabled.
Parameters
-
money
– The amount to be charged to the customer at each interval as an Integer value in cents. -
creditcard
– The CreditCard details for the transaction. -
options
– A hash of parameters.
Options
-
:interval
– A hash containing information about the interval of time between payments. Must contain the keys:length
and:unit
.:unit
can be either:months
or:days
. If:unit
is:months
then:length
must be an integer between 1 and 12 inclusive. If:unit
is:days
then:length
must be an integer between 7 and 365 inclusive. For example, to charge the customer once every three months the hash would be :interval => { :unit => :months, :length => 3 } (REQUIRED) -
:duration
– A hash containing keys for the:start_date
the subscription begins (also the date the initial billing occurs) and the total number of billing:occurrences
or payments for the subscription. (REQUIRED)
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/active_merchant/billing/gateways/authorize_net_arb.rb', line 85 def recurring(money, creditcard, ={}) requires!(, :interval, :duration, :billing_address) requires!([:interval], :length, [:unit, :days, :months]) requires!([:duration], :start_date, :occurrences) requires!([:billing_address], :first_name, :last_name) [:credit_card] = creditcard [:amount] = money request = build_recurring_request(:create, ) recurring_commit(:create, request) end |
#status_recurring(subscription_id) ⇒ Object
Get Subscription Status of a recurring payment.
This transaction gets the status of an existing Automated Recurring Billing (ARB) subscription. Your account must have ARB enabled.
Parameters
-
subscription_id
– A string containing thesubscription_id
of the recurring payment already in place for a given credit card. (REQUIRED)
141 142 143 144 |
# File 'lib/active_merchant/billing/gateways/authorize_net_arb.rb', line 141 def status_recurring(subscription_id) request = build_recurring_request(:status, :subscription_id => subscription_id) recurring_commit(:status, request) end |
#update_recurring(options = {}) ⇒ Object
Update a recurring payment’s details.
This transaction updates an existing Automated Recurring Billing (ARB) subscription. Your account must have ARB enabled and the subscription must have already been created previously by calling recurring(). The ability to change certain details about a recurring payment is dependent on transaction history and cannot be determined until after calling update_recurring(). See the ARB XML Guide for such conditions.
Parameters
-
options
– A hash of parameters.
Options
-
:subscription_id
– A string containing the:subscription_id
of the recurring payment already in place for a given credit card. (REQUIRED)
113 114 115 116 117 |
# File 'lib/active_merchant/billing/gateways/authorize_net_arb.rb', line 113 def update_recurring(={}) requires!(, :subscription_id) request = build_recurring_request(:update, ) recurring_commit(:update, request) end |