Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Stripe Notice: Undefined property of Stripe\SubscriptionItem instance: quantity" swapping metered prices in subscriptions #1320

Closed
pietrantonio91 opened this issue Feb 8, 2022 · 1 comment

Comments

@pietrantonio91
Copy link
Contributor

  • Cashier Version: 13.7.0
  • Laravel Version: 8.73.2
  • PHP Version: 7.4.27
  • Database Driver & Version: MySQL 8

Description:

When swapping a subscripton price with a metered price it retrieve this notice:

Stripe Notice: Undefined property of Stripe\SubscriptionItem instance: quantity

I figured out this should be the problem line:

'quantity' => $item->quantity,

As I've read in other issues and in docs metered prices must have "null" as quantity value.

So I solved this issue with a simple (similar to this issue):

'quantity' => $item->quantity ?? null

Here's my pull request.

Steps To Reproduce:

  1. Create a subscription
  2. $user->subscription()->swap('price_meteredPriceID');
@driesvints
Copy link
Member

Thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants