Update app/Livewire/Subscription/Index.php
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
@@ -50,6 +50,7 @@ class Index extends Component
|
|||||||
|
|
||||||
public function getStripeStatus()
|
public function getStripeStatus()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
$subscription = currentTeam()->subscription;
|
$subscription = currentTeam()->subscription;
|
||||||
$stripe = new \Stripe\StripeClient(config('subscription.stripe_api_key'));
|
$stripe = new \Stripe\StripeClient(config('subscription.stripe_api_key'));
|
||||||
$customer = $stripe->customers->retrieve(currentTeam()->subscription->stripe_customer_id);
|
$customer = $stripe->customers->retrieve(currentTeam()->subscription->stripe_customer_id);
|
||||||
@@ -72,8 +73,15 @@ class Index extends Component
|
|||||||
$this->isCancelled = true;
|
$this->isCancelled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
// Log the error
|
||||||
|
logger()->error('Stripe API error: ' . $e->getMessage());
|
||||||
|
// Set a flag to show an error message to the user
|
||||||
|
$this->addError('stripe', 'Could not retrieve subscription information. Please try again later.');
|
||||||
|
} finally {
|
||||||
$this->loading = false;
|
$this->loading = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user