public function Onsite::deletePaymentMethod in Commerce Core 8.2
Deletes the given payment method.
Both the entity and the remote record are deleted.
Parameters
\Drupal\commerce_payment\Entity\PaymentMethodInterface $payment_method: The payment method.
Throws
\Drupal\commerce_payment\Exception\PaymentGatewayException Thrown when the transaction fails for any reason.
Overrides SupportsStoredPaymentMethodsInterface::deletePaymentMethod
File
- modules/
payment_example/ src/ Plugin/ Commerce/ PaymentGateway/ Onsite.php, line 241
Class
- Onsite
- Provides the On-site payment gateway.
Namespace
Drupal\commerce_payment_example\Plugin\Commerce\PaymentGatewayCode
public function deletePaymentMethod(PaymentMethodInterface $payment_method) {
// Delete the remote record here, throw an exception if it fails.
// See \Drupal\commerce_payment\Exception for the available exceptions.
// Delete the local entity.
$payment_method
->delete();
}