Method: ActiveMerchant::Billing::AuthorizeNetArbGateway#recurring
- Defined in:
- lib/active_merchant/billing/gateways/authorize_net_arb.rb
#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:lengthand:unit.:unitcan be either:monthsor:days. If:unitis:monthsthen:lengthmust be an integer between 1 and 12 inclusive. If:unitis:daysthen:lengthmust 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_datethe subscription begins (also the date the initial billing occurs) and the total number of billing:occurrencesor 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, %i[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 |