Jumpstart docs logo Back to the app

Subscriptions

Subscriptions

Subscriptions in Jumpstart Pro are billed against a Account, not a User. This allows you to handle various different billing situations.

Account billing allows you to share resources and billing functionality with the entire account and allows any member to manage the subscription. It's much easier to start with account billing support than adding it later, so we've got you covered even if you don't need it right away.

For more information on how accounts work in Jumpstart Pro, check out the Accounts documentation.

Defining Subscription Plans

Plans can be defined in the Admin. Each plan should be defined with the price amount in cents.

Free Plans

You can provide free subscriptions to friends and beta testers by using the Pay gem's fake payment processor.

# Ensure Jumpstart Pro free plan exists for admin users
Plan.where(name: "Free").first_or_create(hidden: true, amount: 0, currency: :usd, interval: :month, trial_period_days: 0, fake_processor_id: :free)

# Create a fake subscription for the admin user so they have access to everything by default
account = user.accounts.first
account.set_payment_processor :fake_processor, allow_fake: true
account.payment_processor.subscribe
Enterprise Plans

You can also create enterprise plans with custom pricing text and contact link.

To create an Enterprise Plan, fill out the contact_url attribute with a path like /contact-us or mailto:support@example.org link. You'll also want to set amount to a high value like 999999 to ensure it sorts last on the pricing page.

Sales Flow
  1. Customer views pricing page and contacts sales team.
  2. Your sales team negotiates a custom pricing plan and adds it to your payment processor like Stripe.
  3. Create the enterprise plan in your app's admin area. Mark the plan as "Hidden".
  4. Send customer a link to subscribe with this new, hidden plan.
  5. Customer checks out with custom plan and can manage it under Billing.

Trials

Plans have a trial_period_days:integer attribute to define a trial period. This may also be required on the Price in your payment processor.

Depending on the payment processor, trials may require a payment method or can be configured to capture a payment method later.

Require a subscription

It's common practice to require subscriptions to access certain parts of your application. You can use before_action :require_subscription! in your Rails controllers to ensure that only subscribed users can access certain actions.

For example, the premium_features action can only be accessed by users who are subscribed. If a user who is not subscribed tries to access this action, they will be redirected to the pricing page.

class ProductsController < ApplicationController
  before_action :require_subscription!, only: [:premium_features]

  def premium_features
    # Only accessible by subscribed users
  end
end