What do you use for payment plans, credits, etc?

Hi all

I am playing with using Phoenix with LiveView for a small SaaS app that is more for fun and self-educational purposes, but should still be able to have paid plans and… I failed to figure any standard libraries and advices on how to handle it in Elixir.

Just integrating stripe payments with a library is relatively easy, any other payment provider will also provide you with some sort of a webhook, when payment is happening, but what do you do on the phoenix side then?

What do you use for defining payment plans, tracking credit expirations (which can be tricky with e.g. monthly ones, because of different number of days per month and with taking into account the payer time zone), promo code discounts, etc?

Do you always build all these things from scratch? Or somehow just tunnel the stripe or similar services data to user? Or are there some known libraries to handle some of these matters?

Stripe has an api for recurring payments as you pointed out.

I think the best way to handle it is sign each user up normally. Each user can be part of many “groups” (whatever you want to call them) and each group has one “membership”. This way each user can join a bunch of teams and each team can have many users, but each team only has one membership plan which details the kind of membership that they have. And then every time stripe gets a payment you can log each payment in membership’s payments. This would give you something like slack where someone could join a team or group at will without having to login to a new account. You probably want groups to have many memberships through some intermediate table so that you can list your finite number of plans (as memberships) and then you can track group specific membership data (payments, discount codes, activation dates, etc) on “groups_memberships”

This is something I’m beginning to think about now on my own personal project so any feedback on this design would be appreciated

Many of the processors have a lot of these features available in their product, for instance Stripe Billing.

That will send you webhooks for things like “customer will be rebilled in 3 days” etc and can deal with things like free trials and prorated months.

There are also services that build on top of a payment processor like Chargebee.

The big tradeoff with services like this (versus building it yourself) is that they take a cut, but if you’re building a small SaaS solo you may not want to invest that much time.

I use Bling/Bankroll: GitHub - ozziexsh/bankroll: 💰 Subscription management UI built for Bling

1 Like