New to Rails 3? Check out the Ruby on Rails 3 Tutorial book and screencast.

A book and screencast series showing you how to develop and deploy industrial-strength Rails apps in a direct, step by step way. The screencast series includes 12 lessons over more than 15 hours! Get the best "over the shoulder" experience of following what a top Rails 3 developer does when building an app today. Click here to learn more.

Chargify: Rails Powered Recurring Billing Service With An ActiveResource API

In Elsewhere, Tools

chargifyx.pngOver the last couple of months, a new billing and subscription company - Chargify - have been popping up around the Web 2.0, SaaS, and Rails scenes. Notably, Chargify's CEO is Lance Walley, co-founder of Rails hosting company Engine Yard. Rails developers are a pretty entrepreneurial lot and Chargify have a lot to offer Rails developers who need to set up billing systems.

Upside? Dead Simple Billing

In short, Chargify offers "recurring billing for Web 2.0 & SaaS companies." Once you've started an account (which is free, until you top 50 customers) you can add information about your merchant account, products, subscription plans and pricing models. Then you either direct your customers to a Chargify hosted payment page or supply payment details through an ActiveResource-powered API, and billing is done.

Downside? Merchant Account Needed

Sadly, it seems that Chargify is authorize.net only right now. I asked them whether they were considering adding other systems such as PayPal, but that's not currently a priority. You currently need a merchant account (or be ready to apply for one through them). For other systems, however, there are other services such as Spreedly (which supports 10 different systems and has a gem built by a third party - Richard Livsey).

All Rails: Backend and API

I spoke with Jonathan Kay and Michael Klett of Grasshopper (the company behind Chargify) and it turns out they're Rails powered back and front. Not only that, but their API (chargify_api_ares) is too. Here's some example code for creating a recurring billing record in their system (assuming you've already added the customer to the system - just one other API call):

# Create a subscription from a customer reference
subscription = Chargify::Subscription.create(
  :customer_reference => 'moklett',
  :product_handle => 'chargify-api-ares-test',
  :credit_card_attributes => {
    :first_name => "Michael",
    :last_name => "Klett",
    :expiration_month => 1,
    :expiration_year => 2020,
    :full_number => "1"
  }
)
# Update credit card information
subscription.credit_card_attributes = {:full_number => "2", :expiration_year => "2015"}
subscription.save

Nice, right? It's ActiveResource powered but doesn't necessarily require Rails.

Demo App

Nathan Verni has put together an entire Rails demo app for showing off how Chargify works from a Rails POV. Compared to the old school wrestling with payment systems directly, it's ridiculously easy.

Disclaimer: Chargify is a Ruby Inside advertiser but this is not a paid post or similar. It merely comes from editorial interest caused by talking with them a lot!

Post to Twitter Tweet This Post

Vaguely Related Posts (Usually)

3 Comment Responses to “Chargify: Rails Powered Recurring Billing Service With An ActiveResource API”

  1. #1
    Tim Van Loan Says:

    Hi Peter,

    Good post about subscription billing- it's certainly a big pain to deploy and really takes away time from the most important part of coding an app- getting key features deployed.

    i'm a co-founder of a Ruby- based subscription billing service called Recurly. Much like Chargify, we offer an easy-to-integrate Ruby Gem, so you can get subscriptions up and running quickly. One thing your readers might be excited about is that we currently support several UK and EU payment gateways today (like Sage Payments and PayPal Payments Pro)- so they can deploy us in production today. We're in open beta now so getting access to Recurly is easy as filling out a quick form. You can find out more info at: http://recurly.com/

    This is an exciting space and with so much choice available to developers now we all look forward to helping deploy more Ruby apps. Thanks for highlighting this important- and growing- space!

  2. #2
    Benjamin Curtis Says:

    And don't forget the SaaS Rails Kit at http://railskits.com/saas/ :)

    The billing code is already written for you, and a variety of merchant account providers are supported.

  3. #3
    Lance Walley Says:

    Thank you very much for writing about us; we definitely appreciate it!

    We are adding more payment gateways now. If anyone wants to read details, here's our blog post:

    http://chargify.com/blog/adding-payment-gateways-while-maintaining-data-security

    Fun to be back at a startup, solving a real problem.

    Thanks, again.

Leave a Reply