Automattic\WooCommerce\StoreApi\Schemas\V1

CheckoutSchema::get_checkout_response()protectedWC 1.0

Get the checkout response based on the current order and any payments.

Method of the class: CheckoutSchema{}

No Hooks.

Return

Array.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_checkout_response( $order, $payment_result );
$order(\WC_Order) (required)
Order object.
$payment_result(PaymentResult)
Payment result object.
Default: null

CheckoutSchema::get_checkout_response() code WC 8.9.0

protected function get_checkout_response( \WC_Order $order, PaymentResult $payment_result = null ) {
	return [
		'order_id'          => $order->get_id(),
		'status'            => $order->get_status(),
		'order_key'         => $order->get_order_key(),
		'order_number'      => $order->get_order_number(),
		'customer_note'     => $order->get_customer_note(),
		'customer_id'       => $order->get_customer_id(),
		'billing_address'   => (object) $this->billing_address_schema->get_item_response( $order ),
		'shipping_address'  => (object) $this->shipping_address_schema->get_item_response( $order ),
		'payment_method'    => $order->get_payment_method(),
		'payment_result'    => [
			'payment_status'  => $payment_result->status,
			'payment_details' => $this->prepare_payment_details_for_response( $payment_result->payment_details ),
			'redirect_url'    => $payment_result->redirect_url,
		],
		'additional_fields' => $this->get_additional_fields_response( $order ),
		self::EXTENDING_KEY => $this->get_extended_data( self::IDENTIFIER ),
	];
}