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

Calling latestInvoice() on a subscription with no invoice results in a type error #1112

Closed
wsdimitri opened this issue Apr 6, 2021 · 1 comment · Fixed by #1115
Closed
Labels

Comments

@wsdimitri
Copy link

  • Cashier Version: 12.11.0
  • Laravel Version: 8.35.1
  • PHP Version: 8.0.2

Description:

If you have a Stripe subscription with a null latest_invoice (ie. by creating the subscription with a back dated start date), calling latestInvoice() will throw a TypeError.

Laravel\Cashier\Invoice::__construct(): Argument #2 ($invoice) must be of type Stripe\Invoice, null given ...

I would think this should fail silently and return null?

Steps To Reproduce:

  1. Create a Stripe subscription with a backdate_start_date.
  2. Load the subscription into your Cashier Subscription model.
  3. Call latestInvoice().
@driesvints
Copy link
Member

Thanks. I've sent in a fix here: #1115

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