laravel / cashier-stripe

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

latestPayment() failiure when using send_invoice #1641

Closed l4nos closed 9 months ago

l4nos commented 9 months ago

Cashier Stripe Version

14.14.0

Laravel Version

10.4.1

PHP Version

8.2

Database Driver & Version

MySQl 8.0.31

Description

When you create a subscription using createAndSendInvoice(), it doesn't immediately take payment, so for that subscription there is no latest payment, when you then call latestPayment() it doesn't fail gracefully, it just says:

file: "vendor/laravel/cashier/src/Subscription.php" line: 1379 message: "Call to a member function stripe() on null"

i'm assuming because it cannot get a latest payment, but can't.

It also tries to call asStripeSubscription() before that which in turn tries to get stripe() and fails.

Steps To Reproduce

Mentioned above in description.

l4nos commented 9 months ago

Actually this isn't the problem it seems to be failing on asStripeSubscription() for some reason.