protected function handleCustomerDeleted(array $payload)
    {
        $user = $this->getUserByStripeId($payload['data']['object']['id']);

        if ($user) {
            $user->subscriptions->each(function (Subscription $subscription) {
                $subscription->skipTrial()->markAsCancelled();
            });

            $user->forceFill([
                'stripe_id' => null,
                'trial_ends_at' => null,
                'card_brand' => null,
                'card_last_four' => null,
            ])->save();
        }

        return new Response('Webhook Handled', 200);
    }
protected function handleCustomerDeleted(array $payload)
    {
        $user = $this->getUserByStripeId($payload['data']['object']['id']);

        if ($user) {
            $user->subscriptions->each(function (Subscription $subscription) {
                $subscription->skipTrial()->markAsCancelled();
            });

            $user->forceFill([
                'stripe_id' => null,
                'trial_ends_at' => null,
                'card_brand' => null,
                'card_last_four' => null,
            ])->save();
        }

        return new Response('Webhook Handled', 200);
    }
protected function handleCustomerDeleted ( array $ payload ) { $ user = $ this -> getUserByStripeId ( $ payload [ 'data' ] [ 'object' ] [ 'id' ] ) ; if ( $ user ) { $ user -> subscriptions -> each ( function ( Subscription $ subscription ) { $ subscription -> skipTrial ( ) -> markAsCancelled ( ) ; } ) ; $ user -> forceFill ( [ 'stripe_id' => null , 'trial_ends_at' => null , 'card_brand' => null , 'card_last_four' => null , ] ) -> save ( ) ; } return new Response ( 'Webhook Handled' , 200 ) ; }
Handle deleted customer.

@param  array $payload
@return \Symfony\Component\HttpFoundation\Response
Handle deleted customer .