WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

Automattic\WooCommerce\Blocks\StoreApi\Routes

Checkout::process_payment() protected WC 1.0

Fires an action hook instructing active payment gateways to process the payment for an order and provide a result.

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

Возвращает

PaymentResult.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->process_payment( \WC_Order $order, \WP_REST_Request $request );
$order(\WC_Order) (обязательный)
Order object.
$request(\WP_REST_Request) (обязательный)
Request object.

Код Checkout::process_payment() WC 4.7.1

<?php
protected function process_payment( \WC_Order $order, \WP_REST_Request $request ) {
	$context = new PaymentContext();
	$result  = new PaymentResult();

	$order->update_status( 'pending' );

	$context->set_order( $order );
	$context->set_payment_method( $this->get_request_payment_method_id( $request ) );
	$context->set_payment_data( $this->get_request_payment_data( $request ) );

	try {
		/**
		 * Process payment with context.
		 *
		 * @hook woocommerce_rest_checkout_process_payment_with_context
		 *
		 * @throws \Exception If there is an error taking payment, an Exception object can be thrown
		 *                                     with an error message.
		 *
		 * @param PaymentContext $context Holds context for the payment, including order ID and payment method.
		 * @param PaymentResult  $result Result object for the transaction.
		 */
		do_action_ref_array( 'woocommerce_rest_checkout_process_payment_with_context', [ $context, &$result ] );

		if ( ! $result instanceof PaymentResult ) {
			throw new RouteException( 'woocommerce_rest_checkout_invalid_payment_result', __( 'Invalid payment result received from payment method.', 'woocommerce' ), 500 );
		}

		return $result;
	} catch ( \Exception $e ) {
		throw new RouteException( 'woocommerce_rest_checkout_process_payment_error', $e->getMessage(), 400 );
	}
}