Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.x] Fix webhook command #1407

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Console/WebhookCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class WebhookCommand extends Command
*/
public function handle()
{
$endpoint = Cashier::stripe()->webhookEndpoints->create([
$webhookEndpoints = Cashier::stripe()->webhookEndpoints;

$endpoint = $webhookEndpoints->create([
'enabled_events' => [
'customer.subscription.created',
'customer.subscription.updated',
Expand All @@ -47,7 +49,7 @@ public function handle()
$this->info('The Stripe webhook was created successfully. Retrieve the webhook secret in your Stripe dashboard and define it as an environment variable.');

if ($this->option('disabled')) {
$endpoint->update($endpoint->id, ['disabled' => true]);
$webhookEndpoints->update($endpoint->id, ['disabled' => true]);

$this->info('The Stripe webhook was disabled as requested. You may enable the webhook via the Stripe dashboard when needed.');
}
Expand Down