diff --git a/routes/webhooks.php b/routes/webhooks.php index 5d9257094..a724e8e70 100644 --- a/routes/webhooks.php +++ b/routes/webhooks.php @@ -262,7 +262,10 @@ Route::post('/payments/stripe/events', function () { break; case 'invoice.payment_failed': $customerId = data_get($data, 'customer'); - $subscription = Subscription::where('stripe_customer_id', $customerId)->firstOrFail(); + $subscription = Subscription::where('stripe_customer_id', $customerId)->first(); + if (!$subscription) { + return; + } SubscriptionInvoiceFailedJob::dispatch($subscription->team); break; case 'customer.subscription.updated':