Ruby Plus #65: ActiveMerchant with Authorize.net in Rails Part 2
In this episode you will learn how to use CIM API of Authorize.net gateway to post transactions and add recurring billing logic.
For recurring billing you can check the last_charged_at field in Subscriptions table and if it was successfully processed you can charge the customer based on the interval. Interval attribute can store the frequency of charging a customer for subscriptions. I am using months as the unit for this attribute.Write a method in CustomerProfile model to check the subscriptions table for any pending charges that must be posted to the gateway. Use this class method in a Rake task that will be run by a CRON job.
Resources: How to create domain modelThe download includes the source code and the billing domain model diagram that is capable of handling recurring charges.