Chargebee Logo

Rails Plugin for Chargebee

This ruby gem provides you with a set of boilerplate classes to accelerate the implementation of a subscription billing module onto your rails application.
Rails Plugin for Chargebee
Workflow of Chargebee

    The gem can automatically handle:

  • 1. Setting up of relevant db models to store subscription data.
  • 2. Upgrade/downgrade of subscriptions.
  • 3. Coupons.
  • 4. Webhooks from Chargebee to ensure the data is in sync.
  • Apart from this, the gem also supports:

  • 1. Template webhook handling controllers that you can simply inherit and override.
  • 2. Pluggable tracking of metered billing usage (also customizable).
  • 3. APIs to handle various subscription billing scenarios.
  • 1. Install the “chargebee_rails” gem to your application.
    • gem 'chargebee_rails'
    • And, run
    • bundle
  • 2. Add Subscription models to your app
    • Note: Presence of subscription owner model (For example user, customer, etc.) is required
    • rails g chargebee_rails:install <subscription_owner_entity>
    • Allow migration to override templates
    • rake db:migrate
  • 3. Set up Chargebee
    • Configure your Chargebee site name and API key in the config/initializers/chargebee_rails.rb file.
    • #The API key can be found in your Chargebee site under Settings> API & WEBHOOKS > API Keys
    • config.chargebee_site = 'CHARGEBEE_SITE'
    • #The API key can be found in your Chargebee site under Settings> API & WEBHOOKS > API Keys
    • config.chargebee_api_key = 'CHARGEBEE_API_KEY