App\Ninja\PaymentDrivers\StripePaymentDriver::removePaymentMethod PHP Method

removePaymentMethod() public method

public removePaymentMethod ( $paymentMethod )
    public function removePaymentMethod($paymentMethod)
    {
        parent::removePaymentMethod($paymentMethod);
        if (!$paymentMethod->relationLoaded('account_gateway_token')) {
            $paymentMethod->load('account_gateway_token');
        }
        $response = $this->gateway()->deleteCard(['customerReference' => $paymentMethod->account_gateway_token->token, 'cardReference' => $paymentMethod->source_reference])->send();
        if ($response->isSuccessful()) {
            return true;
        } else {
            throw new Exception($response->getMessage());
        }
    }