laravel / cashier-stripe

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.
https://laravel.com/docs/billing
MIT License
2.37k stars 671 forks source link

Add an Prorate() function to reverse the noProrate() function #647

Closed yougotnet closed 4 years ago

yougotnet commented 5 years ago

Description:

The problem with the noProrate option is that when you execute a swap right afterward a swap with noProrate() function you can't turn on Prorate.

If I have a user downgrade the plan, I do not want to prorate or give a refund, but if the user downgrades and then upgrades higher to what the originally paid during the subscription period, then I want to swap to the original plan with noProrate and then swap to a higher plan with a Prorate.

What I did to fix the issue on my end is add a new function to the Subscription model called Prorate() so that I can turn the $prorate flag to true. If you would simply add the function to the base code it would help a lot of developers out.

Steps To Reproduce:

driesvints commented 5 years ago

Okay, I could see the benefit of this. Feel free to suggest something but please add a test as well.