Quickstart Billing Subscriptions Deployment Kamal

Subscriptions

Business Class support recurring subscriptions for Paddle and Stripe based on Pay.

Design

The subscriptions design supports running multiple providers side by side to allow for switching out providers when necessary, but with only one provider accepting new subscriptions at a time.

Subscriptions are always started by team owners and tighed to them. They are then tight to a team by their name.

Providers

To start, enable the processor you want to use:

# config/initializers/pay.rb
# Allow fake_processor to support the free plan
  config.enabled_processors = [:paddle, :stripe, :fake_processor]

If both providers are set up, SubscriptionController#start dictate the priority for new subscriptions.

If you only ever to plan to use one provider, you can simplify the code and delete the other. The relevant code is in the Subscription model, the SubscriptionsController controller, and paddle.rb and stripe.rb initializers.

Since Pay also supports other providers it’s possible to reimplement the frontend part to switch to these providers, but note there might be small differences between these payment processors.

Free plans

You can offer your customers a free plan. This is useful for having your own free access as well as testing before setting up a provider.

A super user can subscribe to a free plan as well as move existing customer to a free plan from the administration area.

To enable it globally, set the ENABLE_FREE_PLAN environment variable.