Skip to content

Commit

Permalink
Fix webhook command (#1407)
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints authored Jul 29, 2022
1 parent 134dc4a commit c815119
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit c815119

Please sign in to comment.