Tuesday, July 24, 2007

Recurring Billing in Rails

Research notes:

Dealing with subscriptions payment
Follow-up to subscriptions
Recharging to the Same Credit Card

Sample test case:

def test_reference_purchase
assert response = @gateway.purchase(Money.new(10000), @creditcard, @options)
assert_equal "Approved", response.message
assert response.success?
assert response.test?
assert_not_nil pn_ref = response.authorization

# now another purchase, by reference
assert response = @gateway.purchase(Money.new(10000), pn_ref)
assert_equal "Approved", response.message
assert response.success?
assert response.test?
end

Acts As Billable Plugin

script/plugin install http://source.collectiveidea.com/public/acts_as_billable/trunk/
There’s a start of a sample app (that uses rspec) that goes with it at http://source.collectiveidea.com/public/acts_as_billable/samples/depot

Authorize.Net Automated Recurring Billing (ARB) Example Code

ARG Guide

1 comment: