'Laravel stripe preview Invoice if the subscription has a scheduled transition

Logic of my subscriptions. If the transition from smaller to larger is smooth, I calculate proportionally. If there was a transition from a higher to a lower tariff, I set the scheduler, until the end of the subscription time I use the current one and only the subscription below applies to this field.

But the problem is when I have a subscription with a planned transition and want to see a proportional deduction from tariff 2 to tariff 3

 $this->user->subscription()->previewInvoice($request->plan)
enter code here

Returns null. Only after I have reset the planner from the subscription can I continue to display

$this->user->subscription()->previewInvoice($request->plan).

error The subscription is managed by the subscription schedule sub_sched_1KzOn1LueT3PfXuFbTGP5RxT, and updating any cancelation behavior is not allowed.

can I virtually calculate so as not to affect the scheduler?

Can you tell me how to get it, it causes a problem.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source