bpuig/laravel-subby

Feature upgrades in the middle of an active subscription

boryn opened this issue · 7 comments

boryn commented

While upgrading a feature in the middle of an active subscription, it would nice to be able to calculate the proportion of remaining days per invoice_interval.

Let's say someone's subscription period finishes at 21th day of each month. Today we have 13th, so there are 8 days to go and while doing the upgrade, the subscriber should pay 8/30 * price of the feature. I know the payments are out of scope of this library but this calculation would be very convenient for handling upgrade payments for a partial period.

boryn commented

And I wonder how to handle the situation when people want to make settlements on the "fixed" months basis (jan, feb, mar, etc.) but they subscribed in the mid of month? Should we somehow modify the starts_at or ends_at dates?

bpuig commented

And I wonder how to handle the situation when people want to make settlements on the "fixed" months basis (jan, feb, mar, etc.) but they subscribed in the mid of month? Should we somehow modify the starts_at or ends_at dates?

I guess you should put that date when creating subscription newSubscription(string $tag, Plan $plan, string $name, Carbon $startDate = null), it's the last parameter.

bpuig commented

The subscriber should pay 8/30 * price of the feature.

That is the main issue here, features have no price in this package. I think it would be better to make an extension that solves this along #41 , because both fall under the same scenario of paying for features.

boryn commented

#41 is different, as that concerns payment mode for the whole subscription.

Here calculating 8/30 is just to get the proportion. And upgrade could be as well per plan, not the feature. But I meant here just calculating $remainingPeriodPercentage. Of course one can calculate it outside of the library but I just see it would be convenient to have it here.

boryn commented

Or just $subscription->getRemainingDays() (and maybe $subscription->getRemainingTrialDays())?

bpuig commented

Like this? e2f5f41
New getDaysUntilEnds(), getDaysUntilTrialEnds() and getRemainingPriceProrate()

boryn commented

Please have a look at #47