WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Routes

Checkout::get_request_payment_method() private WC 1.0

Gets the chosen payment method from the request.

{} It's a method of the class: Checkout{}

No Hooks.

Return

\WC_Payment_Gateway.

Usage

// private - for code of main (parent) class only
$result = $this->get_request_payment_method( $request );
$request(WP_REST_Request) (required)
Request object.

Code of Checkout::get_request_payment_method() WC 5.8.0

private function get_request_payment_method( \WP_REST_Request $request ) {
	$payment_method_id  = $this->get_request_payment_method_id( $request );
	$available_gateways = WC()->payment_gateways->get_available_payment_gateways();

	if ( ! isset( $available_gateways[ $payment_method_id ] ) ) {
		throw new RouteException(
			'woocommerce_rest_checkout_payment_method_disabled',
			__( 'This payment gateway is not available.', 'woocommerce' ),
			400
		);
	}

	return $available_gateways[ $payment_method_id ];
}