From 115b880a057f598bed50b81801f17c29a2f52ae8 Mon Sep 17 00:00:00 2001 From: Przemek Dziewa Date: Tue, 31 Oct 2023 19:22:39 +0100 Subject: [PATCH] fix missing lemon_squeezy_id if billable was on generic trial at the model level --- src/Http/Controllers/WebhookController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Http/Controllers/WebhookController.php b/src/Http/Controllers/WebhookController.php index 669fdb3..1cc5173 100644 --- a/src/Http/Controllers/WebhookController.php +++ b/src/Http/Controllers/WebhookController.php @@ -109,6 +109,11 @@ public function handleSubscriptionCreated(array $payload): void $billable->customer->update(['trial_ends_at' => null]); } + // Set the billable's lemon squeezy id if it was on generic trial at the model level + if (is_null($billable->customer->lemon_squeezy_id)) { + $billable->customer->update(['lemon_squeezy_id' => $attributes['customer_id']]); + } + SubscriptionCreated::dispatch($billable, $subscription, $payload); }