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

Increment Quantity on MultiPlan #917

Closed Cragstar closed 4 years ago

Cragstar commented 4 years ago

Description:

When using the following method to update the quantities on a specific plan on a subscription $user->subscription('default')->incrementQuantity(5, 'chat-plan'); I receive the following error

"This method requires a plan argument since the subscription has multiple plans."

Steps To Reproduce:

  1. Create a function server side to increase the quantities of the plan (i.e additional users above the base number that comes with the main subscription) Condensed version of the code $type = Subscription::where('business_id', $userID)->firstOrFail(); $subscribe = $user->subscription($type->name)->incrementQuantity(1, 'plan_NUMBERISHERE');

  2. Call this function via the web interface

  3. Laravel return the error stated above

You can see I am supplying a plan number to the method.

driesvints commented 4 years ago

I see the issue and I'll fix it. Thanks for reporting!

driesvints commented 4 years ago

Fixed now in v11.2.0

Cragstar commented 4 years ago

With a subscription item this only changes the quantity to the value passed in the increment and not by the number that is passed. $user->subscription('default')->incrementQuantity(5, 'chat-plan'); Will change the quantity to 5 and not from say 2 -> 7 which an increment of 5 would do?

driesvints commented 4 years ago

You're right and good that you spotted this. I'll tackle this today 👍