1

I want to offer my customers the ability to upgrade and downgrade their subscription. When they upgrade, the plan is prorated. When they downgrade, it isn't.

This is what i got so far:

if(auth()->user()->plan()['price'] <= $newPlanPrice){
    auth()->user()->subscriptions()->active()->first()->swap($request->plan);
} else {
    auth()->user()->subscriptions()->active()->first()->noProrate()->swap($request->plan);
}

But the subscription is swapped instantly. For upgrades, this is good, because i want the users to have access to the new functionalities, but for downgrades it isnt good.

When a customer downgrades, he should keep all the functionalities till the end of the billing cycle. They have paid for it after all.

How do I swap the subscription at the end of the billing cycle?

Remi
  • 39
  • 6

0 Answers0