mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 09:34:33 -04:00
Detach payment methods from Stripe
This commit is contained in:
parent
020005d20d
commit
71ca5d108c
@ -395,4 +395,26 @@ class StripePaymentDriver extends BasePaymentDriver
|
||||
|
||||
return $payment->service()->applyNumber()->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Detach payment method from the Stripe.
|
||||
* https://stripe.com/docs/api/payment_methods/detach
|
||||
*
|
||||
* @param \App\Models\ClientGatewayToken $token
|
||||
* @return bool
|
||||
*/
|
||||
public function detach(ClientGatewayToken $token)
|
||||
{
|
||||
$stripe = new \Stripe\StripeClient(
|
||||
$this->company_gateway->getConfigField('apiKey')
|
||||
);
|
||||
|
||||
try {
|
||||
$response = $stripe->paymentMethods->detach($token->token);
|
||||
} catch (\Exception $e) {
|
||||
SystemLogger::dispatch([
|
||||
'server_response' => $response, 'data' => request()->all(),
|
||||
], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_FAILURE, SystemLog::TYPE_STRIPE, $this->client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user