WC_Checkout::process_order_payment( int $order_id, string $payment_method )
Process an order that does require payment.
Description Description
Parameters Parameters
- $order_id
-
(Required) Order ID.
- $payment_method
-
(Required) Payment method.
Source Source
File: includes/class-wc-checkout.php
protected function process_order_payment( $order_id, $payment_method ) { $available_gateways = WC()->payment_gateways->get_available_payment_gateways(); if ( ! isset( $available_gateways[ $payment_method ] ) ) { return; } // Store Order ID in session so it can be re-used after payment failure. WC()->session->set( 'order_awaiting_payment', $order_id ); // Process Payment. $result = $available_gateways[ $payment_method ]->process_payment( $order_id ); // Redirect to success/confirmation/payment page. if ( isset( $result['result'] ) && 'success' === $result['result'] ) { $result = apply_filters( 'woocommerce_payment_successful_result', $result, $order_id ); if ( ! is_ajax() ) { wp_redirect( $result['redirect'] ); exit; } wp_send_json( $result ); } }
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |