Automattic\WooCommerce\Internal\RestApi\Routes\V4\Settings\PaymentGateways

Controller::get_payment_gatewayprivateWC 1.0

Get a gateway based on the current request object.

Method of the class: Controller{}

No Hooks.

Returns

WC_Payment_Gateway|null.

Usage

// private - for code of main (parent) class only
$result = $this->get_payment_gateway( $id ): ?WC_Payment_Gateway;
$id(string) (required)
Gateway ID.

Controller::get_payment_gateway() code WC 10.4.3

private function get_payment_gateway( $id ): ?WC_Payment_Gateway {
	$payment_gateways = WC()->payment_gateways->payment_gateways();
	return $payment_gateways[ $id ] ?? null;
}