bpuig / laravel-subby

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

Need a little help #109

Closed Fayozjon closed 2 years ago

Fayozjon commented 2 years ago

How properly subscribe user to NEW plan and stop from other

For example i have Free plan by default (which i SUBSCRIBE on user signup) After that user can upgrade to other paid plan

How to do it properly? Please provide example

Also couldnt find anything about subcrtiption CRON JOBS for autocancellation of old subscriptions

bpuig commented 2 years ago

How properly subscribe user to NEW plan and stop from other

Easy, just change plan: https://bpuig.github.io/laravel-subby/v5.x/models/plan-subscription-model.html#change-its-plan

$plan = Plan::find(2);
$subscription = PlanSubscription::find(1);

// Change subscription plan clearing usage and synchronizing invoicing periods
$subscription->changePlan($plan);

For example i have Free plan by default (which i SUBSCRIBE on user signup) After that user can upgrade to other paid plan

How to do it properly? Please provide example

Just like the example before (imagine shown plan with id 2 is the paid plan).

Also couldnt find anything about subcrtiption CRON JOBS for autocancellation of old subscriptions

At the moment there is no automated handling of renewals, cancels, etc. That, at the moment, falls out of the scope. You'll have to do your own. The closest thing to handling something is the "schedule" feature, that has some jobs and services to handle plan changes in future dates.

Any doubts, feel free to ask.

boryn commented 2 years ago

@bpuig, maybe you could open the "Discussions" tab here at github for this kind of conversations/questions, actually not being "Issues"?

bpuig commented 2 years ago

@bpuig, maybe you could open the "Discussions" tab here at github for this kind of conversations/questions, actually not being "Issues"?

Done! I close this and @Fayozjon can continue the conversation there 🙃