Ask A Question


Youโ€™re not receiving notifications from this thread.

How would you set up these plans in Stripe?

Daniel Weaver asked in Gems / Libraries
We bill our customers on monthly subscriptions, based on their resource usage in the app. They are private music schools and we charge by the number of students they have.

The ranges are as follows:
1-50 students is $19/month
51-100 students is $49/month
101-250 students is $79/month
251-500 students is $129/month
and then an extra $25 per 100 after that.

Initially I created lots of individual plans in Stripe, one for each range of students. This has a number of issues:

  • If we want to change our prices we have to tear down all the plans and create a whole set of new ones because plan amounts can't be updated. We then have to migrate all schools to the new plans.
  • As we get larger and larger schools onboard, the number of plans continues to grow. We're up into the 1,000s of students now. All the plans also have to be duplicated in Stripe's test mode too.
  • Switching a school between plans is problematic during the month. It's possible to switch plans without prorating, which is what we want, but I don't want a flood of Stripe API hits every time a school's student number changes.

My solution to the last issue is to use the `invoice.created` webhook from Stripe and just check the student number once, right at the point of charging. This works fine but doesn't solve the first two problems.

A possible solution for the first two points (since we're already using the `invoice.created` webhook) is to put each school on the lowest $19/month plan then, at the point of charging, look up the number of students and add an invoice item to adjust the invoice total to the correct amount.

For instance, a school with 150 students should pay $79/month. They would already be on the $19/month so I would add an invoice item of $60, called "150 students", to bring the total to $79. But I'm concerned this will look confusing to the customer.

As you can tell, I've been going around in circles with this so any help or advice would be much appreciated!

I'm happy to pay for a consultation session if there are any Rails/Stripe experts out there willing to jump in! ๐Ÿ˜‰ 
Hey Daniel!

You've hit the point where Stripe subscriptions break down I see. :) Unfortunately they don't offer anything too complex like this and it's a bit disappointing.

I like your idea on adjusting the invoices. That would be an easy adjustment each month and wouldn't be too hard.

A slight alternative to that would be to build your own custom billing system. Basically a cron job that runs nightly and processes payments for users who subscribed that day of the month (or just run payments every 1st of the month or something). You can then do the calculations and create a Charge object each time without dealing with Stripe Subscription objects at all.

You'd have infinite more flexibility this way, but a bit more work on your shoulders to manage. Kind of depends on how pricing might change in the future, but I'd probably consider doing it from scratch at this point, although your base subscription + adjustments model does a pretty darn good job of balancing Stripe Subscriptions without having to resort to a completely custom system.
Bizarrely, Stripe have just introduced some major changes to the way subscriptions are handled. They're now based on Products (marked as 'service') and have functions for tiered and graduated pricing.

Unfortunately, from what I can tell of the docs, none of this helps in my particular situation ๐Ÿ˜‚
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 83,038+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.