diff --git a/app/Jobs/HandleCustomerSubscriptionCreatedJob.php b/app/Jobs/HandleCustomerSubscriptionCreatedJob.php index e6634d2..770ebe3 100644 --- a/app/Jobs/HandleCustomerSubscriptionCreatedJob.php +++ b/app/Jobs/HandleCustomerSubscriptionCreatedJob.php @@ -8,6 +8,7 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; +use Illuminate\Support\Facades\Log; use Laravel\Cashier\Cashier; use Laravel\Cashier\Events\WebhookHandled; use Laravel\Cashier\SubscriptionItem; @@ -29,6 +30,12 @@ public function handle(): void return; } + if ($stripeSubscription->status !== 'active') { + Log::info("The subscription for customer [{$stripeSubscription->customer}] is not active. Not proceeding to license creation."); + + return; + } + /** @var User $user */ $user = Cashier::findBillable($stripeSubscription->customer);