Automattic\WooCommerce\StoreApi\Schemas\V1
CheckoutSchema::get_checkout_response()
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() CheckoutSchema::get checkout response code WC 7.7.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(), 'customer_note' => $order->get_customer_note(), 'customer_id' => $order->get_customer_id(), 'billing_address' => $this->billing_address_schema->get_item_response( $order ), 'shipping_address' => $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, ], self::EXTENDING_KEY => $this->get_extended_data( self::IDENTIFIER ), ]; }