diff --git a/app/Livewire/MobilePricing.php b/app/Livewire/MobilePricing.php index b90c47e1..7bded0f7 100644 --- a/app/Livewire/MobilePricing.php +++ b/app/Livewire/MobilePricing.php @@ -24,8 +24,15 @@ public function handlePurchaseRequest(array $data) return $this->createCheckoutSession($data['plan'], $user); } - public function createCheckoutSession(string $plan, ?User $user = null) + public function createCheckoutSession(?string $plan, ?User $user = null) { + // This method is somehow getting called without a plan being passed in. + // Not sure how (probably folks hacking or a bot thing), + // but we will just return early when this happens. + if (! $plan) { + return; + } + // If a user isn't passed into this method, Livewire will instantiate // a new User. So we need to check that the user exists before using it, // and then use the authenticated user as a fallback.