WC_REST_Payment_Gateways_V2_Controller::get_itemspublicWC 1.0

Get payment gateways.

Method of the class: WC_REST_Payment_Gateways_V2_Controller{}

No Hooks.

Returns

WP_Error|WP_REST_Response.

Usage

$WC_REST_Payment_Gateways_V2_Controller = new WC_REST_Payment_Gateways_V2_Controller();
$WC_REST_Payment_Gateways_V2_Controller->get_items( $request );
$request(WP_REST_Request) (required)
Full details about the request.

WC_REST_Payment_Gateways_V2_Controller::get_items() code WC 10.4.3

public function get_items( $request ) {
	$payment_gateways = WC()->payment_gateways->payment_gateways();
	$data             = array();
	foreach ( $payment_gateways as $payment_gateway_id => $payment_gateway ) {
		$payment_gateway->id = $payment_gateway_id;
		$gateway             = $this->prepare_item_for_response( $payment_gateway, $request );
		$gateway             = $this->prepare_response_for_collection( $gateway );
		$data[]              = $gateway;
	}

	$total    = count( $data );
	$response = rest_ensure_response( $data );
	$response->header( 'X-WP-Total', (int) $total );
	$response->header( 'X-WP-TotalPages', $total ? 1 : 0 );
	return $response;
}