bpuig / laravel-subby

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

Trial flexibility, plans allow new trial modes #75

Closed bpuig closed 3 years ago

bpuig commented 3 years ago

Now plans allow 3 trial modes, those are prepend, in_period and detach.

Prepend (current behaviour)

With prepend mode, trial period will be placed before starting subscription.

Example: 7 days trial + 30 day subscription. 7 days of trial will be placed before 30 day subscription starts.

In period

With in_period mode, trial period will elapse during subscriptions period.

Example: 7 days trial + 30 day subscription. 7 days of trial will be placed inside the 30 day subscription.

Detach

With detach mode, trial period will end and no subscription will be made.

Example: 7 days trial + 30 day subscription. 7 days of trial. Then subscription should be renewed to start.

bpuig commented 3 years ago

I discard this idea, after giving it a thought I do not find it useful.

boryn commented 3 years ago

;) I was just about to write my thoughts :)

I think, the in_period mode could be useful, but not see usage for the detach mode - subscription do not create automatically, so I see it the same as prepend.

The in_period mode would have an impact on the ->renew() method - that is renewal (or rather starting of the subscription) would be made for "30 days" from the start of the trial and not from now(). And this would be useful. Probably should inflict as well behaviour of the usage of features (not resetting them, keeping what has been already consumed during the trial).

And IMHO I still think that if we have subscription with trial, then ends_at should be the same as trial_ends_at and starts_at should be now(). It's so much more intuitive - we know the end date with no ifs (if trial? / if no trial?), and as well can easily display it to user.

bpuig commented 3 years ago

Right now I'm working on a simple logic: if subscriber has trial, subscriber does not have subscription. So then you can decide what to do when trial ends, either renew() keep it dead or whatever.

boryn commented 3 years ago

How would we define features for the trial? As they can differ from the target subscription. Or it would be treated as well as a subscription, but with the flag "trial"?

bpuig commented 3 years ago

Or it would be treated as well as a subscription, but with the flag "trial"?

This.

But with this new approach it's not too difficult to make 2 sets of features, I just need to add one column in subscription_plan_features that refers to subscription vs trial. And since there are already methods to sync features, trial features would be forced to disappear and be synchonized with subscription ones on renewal.