/** * Handle a cancelled customer from a Stripe subscription. * * @param array $payload * @return Response */ protected function handleCustomerSubscriptionDeleted(array $payload) { parent::handleCustomerSubscriptionDeleted($payload); $user = $this->getUserByStripeId($payload['data']['object']['customer']); if (!$user) { return $this->teamSubscriptionDeleted($payload); } event(new SubscriptionCancelled($this->getUserByStripeId($payload['data']['object']['customer']))); return new Response('Webhook Handled', 200); }
/** * Handle a subscription cancellation notification from Braintree. * * @param string $subscriptionId * @return Response */ protected function cancelSubscription($subscriptionId) { parent::cancelSubscription($subscriptionId); if (!$this->getSubscriptionById($subscriptionId)) { return $this->cancelTeamSubscription($subscriptionId); } if ($subscription = $this->getSubscriptionById($subscriptionId)) { event(new SubscriptionCancelled($subscription->user)); } return new Response('Webhook Handled', 200); }