From c30185c6ae8b779ae0e4c29a6dc4de8b4537ecc4 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 27 May 2024 12:03:48 +0200 Subject: [PATCH] feat: Handle incomplete expired subscriptions in Stripe webhook --- app/Http/Controllers/Webhook/Stripe.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/Webhook/Stripe.php b/app/Http/Controllers/Webhook/Stripe.php index 7d6721252..87b18c009 100644 --- a/app/Http/Controllers/Webhook/Stripe.php +++ b/app/Http/Controllers/Webhook/Stripe.php @@ -150,6 +150,10 @@ class Stripe extends Controller $subscription = Subscription::where('stripe_customer_id', $customerId)->first(); } if (!$subscription) { + if ($status === 'incomplete_expired') { + send_internal_notification('Subscription incomplete expired for customer: ' . $customerId); + return response("Subscription incomplete expired", 200); + } send_internal_notification('No subscription found for: ' . $customerId); return response("No subscription found", 400); }