Automattic\WooCommerce\StoreApi\Schemas\V1

CheckoutSchema::prepare_payment_details_for_response()protectedWC 1.0

This prepares the payment details for the response so it's following the schema where it's an array of objects.

{} Это метод класса: CheckoutSchema{}

Хуков нет.

Возвращает

Массив. An array of objects where each object has the key and value as distinct properties.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->prepare_payment_details_for_response( $payment_details );
$payment_details(массив) (обязательный)
An array of payment details from the processed payment.

Код CheckoutSchema::prepare_payment_details_for_response() WC 6.8.0

protected function prepare_payment_details_for_response( array $payment_details ) {
	return array_map(
		function( $key, $value ) {
			return (object) [
				'key'   => $key,
				'value' => $value,
			];
		},
		array_keys( $payment_details ),
		$payment_details
	);
}