bpuig / laravel-subby

Laravel Plan and Subscriptions manager.
https://bpuig.github.io/laravel-subby
MIT License
104 stars 42 forks source link

How to define the same plans with different payment periods? #90

Closed boryn closed 2 years ago

boryn commented 3 years ago

Hi @bpuig! Actually what is your way to define the same plan but with different payment periods? I mean we want to have "Basic" plan paid monthly or yearly. I'd go with tags basic-monthly and basic-yearly defining appropriately the price and invoice_interval fields. But with this approach I come into a problem of grabbing and presenting the all payment options for the "Basic" tag. It's quite cumbersome to filter the tag field by LIKE 'basic-%'.

PS. All these "Basic" plans use the same feature set. With my approach I need to duplicate the definitions at plan_features.

bpuig commented 3 years ago

This would be a new part of the package, because plan per se it's the same, just that you pay 12 months in advance. In v5, this would be (just by memory, don't trust me) something like renew(12) and pay whatever quantity.

The solution is a new "plan prices" part where you can input plan, number of periods and price. It's a good idea, but maybe for v6.

Edit: This is also related to #90 . So maybe we can do both in v6

boryn commented 3 years ago

Yes, we can renew whatever number of periods having accepted whatever amount of money, but the exact definition of plans with their prices is often used to display pricing tables in the front-end. And they are often got fetched through API and that's why it's important to have all the pricings in the plans table.

At this moment I use this basic-monthly / basic-yearly or even basic-monthly-usd / basic-yearly-usd / basic-monthly-eur / basic-yearly-eur approach, but it's not optimal and thought you have some better solution for now.