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

Updating quantity of existing subscription, and then invoicing leads to stripe error. #1433

Closed
robtesch opened this issue Aug 31, 2022 · 1 comment · Fixed by #1434
Closed
Labels

Comments

@robtesch
Copy link

  • Cashier Version: v14.1.0
  • Laravel Version: v9.27.0
  • PHP Version: 8.1.9
  • Database Driver & Version: MySQL 8.0.30

Description:

If I try to update the quantity of an existing subscription, and then invoice them immediately (this only applies when increasing their quantity) like so:

if($newQuantity > $oldQuantity) {
    $subscription->updateQuantity($newQuantity);
    $subscription->invoice();
}

I get the following error in stripe:

invalid_request_error - pending_invoice_items_behavior You may only specify one of these parameters: pending_invoice_items_behavior, subscription.

It looks like \Laravel\Cashier\Concerns\ManagesInvoices.php:122 might be out of date in terms of how it operates? More likely I missed something in the upgrade guide, since this used to work just fine in before v14.

@driesvints
Copy link
Member

That's odd because the Stripe API docs don't explicitly say you can't combine those: https://stripe.com/docs/api/invoices/create#create_invoice-subscription. They even hint that you can.

I see we don't have a test for this so I'll add one and check for a solution.

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

Successfully merging a pull request may close this issue.

2 participants