Skip to content

Commit 9b9d807

Browse files
committed
do not create a license upon inactive subscription creation
1 parent fd0b237 commit 9b9d807

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/Jobs/HandleCustomerSubscriptionCreatedJob.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Illuminate\Foundation\Bus\Dispatchable;
99
use Illuminate\Queue\InteractsWithQueue;
1010
use Illuminate\Queue\SerializesModels;
11+
use Illuminate\Support\Facades\Log;
1112
use Laravel\Cashier\Cashier;
1213
use Laravel\Cashier\Events\WebhookHandled;
1314
use Laravel\Cashier\SubscriptionItem;
@@ -29,6 +30,12 @@ public function handle(): void
2930
return;
3031
}
3132

33+
if ($stripeSubscription->status !== 'active') {
34+
Log::info("The subscription for customer [{$stripeSubscription->customer}] is not active. Not proceeding to license creation.");
35+
36+
return;
37+
}
38+
3239
/** @var User $user */
3340
$user = Cashier::findBillable($stripeSubscription->customer);
3441

0 commit comments

Comments
 (0)