Closed boryn closed 3 years ago
When creating a sub based on plan without a trial I presume everything's fine, as the starts_at
got 'now()':
Yes, when a trial ends, a subscription starts, but as I metioned here https://github.com/bpuig/laravel-subby/issues/57 , maybe I should introduce a method to choose if trial is inside period or before period.
Right now you can only: Trial starts ➡️ +7 days ➡️ trial ends ➕ subscription starts ➕ is charged ➡️ +1 month ➡️ subscription ends ➡️ renewal, cancel, etc...
You should be able to also: Trial ➕ subscription start ➡️ +7 days ➡️ trial ends ➕ is charged ➡️ +23 days (remaining month, whatever) ➡️ subscription ends ➡️ renewal, cancel, etc...
When we treat a trial as free of charge / free to use, so actually the current solution with renew()
starting a new period and resetting the usage is not that bad.
And the second solution should keep the usage.
The other thing is when do we take the credit card details? Upon registration or when the user decides for the paid subscription? I can see it's more popular not to require payment details upon registration and give the trial.
But there are companies which decide to charge let's say $1 for the trial and only after 7 days charge the full amount. Should plan definition include price for the trial?
If there are so many options, maybe the library should give a developer the power to set all these dates manually?
$startDate = Carbon::now();
// or
$startDate = $user->subscription()->getStartDate();
$endDate = $user->subscription()->calculateEndDate($startDate); //taking into account defined intervals
$user->subscription()->uncancel()->setStartDate($startDate)->setEndDate($endDate)->deleteUsage();
and even setPrice()
, setCurrency()
, setInvoicePeriod()
and setInvoiceInterval()
?
And coming back to the starts_at
- IMHO even with trial starts_at
should be 'now()'. Because with current implementation the starts_at
equal to ends_at
is very misleading and actually we never use it, it brings nothing. With starts_at
set to 'now' upon subscription creation we would know the beginning of the trial, now we do not know it.
The other thing is when do we take the credit card details? Upon registration or when the user decides for the paid subscription? I can see it's more popular not to require payment details upon registration and give the trial.
Some people will beforehand, others after trial. Depends on the user.
But there are companies which decide to charge let's say $1 for the trial and only after 7 days charge the full amount. Should plan definition include price for the trial?
Since payments or any kind of price calculations are out of the package, at the moment this would fall under the category of package customization.
and even
setPrice()
,setCurrency()
,setInvoicePeriod()
andsetInvoiceInterval()
?
A couple more of this methods and you can instead use directly ->subscriptions()->create()
. Is this fine tunning really necessary? Why are we even using plans then? You can update all this values after insert.
And coming back to the
starts_at
- IMHO even with trialstarts_at
should be 'now()'. Because with current implementation thestarts_at
equal toends_at
is very misleading and actually we never use it, it brings nothing. Withstarts_at
set to 'now' upon subscription creation we would know the beginning of the trial, now we do not know it.
What happens if trial is 3 months for free (like those ads on youtube for VPN, they give LOTS of trial time) but the subscription period is 1 month? Trial would exceed your period. Superweird. There maybe is the need of having also method 2 like I said on https://github.com/bpuig/laravel-subby/issues/58#issuecomment-844094240
I think the subscription period is not yet relevant when talking about the trial itself? With 3 month trial we should have start_at
at now() and ends_at
at 3 months from now. Renewing the subscription will modify the ends_at
accordingly.
And the option if trial is inside or before subscription would be a good solution. If trial is before, renewing the subscription will set the ends_at
to ends_at
+ 1 month.
Take a look at this branch. Careful, because it will be v5 and has migrations. Docs have been updated for Plans.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
After creating a new subsription with a plan having a defined 7 day trial with
$user->newSubscription('primary', $plan);
, the fieldstarts_at
gets the date of thetrial_ends_at
/ends_at
. Is it an expected behaviour?