WC_Gateway_BACS::process_payment()
Process the payment and return the result.
Method of the class: WC_Gateway_BACS{}
Hooks from the method
Return
Array
.
Usage
$WC_Gateway_BACS = new WC_Gateway_BACS(); $WC_Gateway_BACS->process_payment( $order_id );
- $order_id(int) (required)
- Order ID.
WC_Gateway_BACS::process_payment() WC Gateway BACS::process payment code WC 9.6.1
public function process_payment( $order_id ) { $order = wc_get_order( $order_id ); if ( $order->get_total() > 0 ) { /** * Filter the order status for BACS payment. * * @since 3.4.0 * * @param string $default_status The default order status. * @param object $order The order object. */ $process_payment_status = apply_filters( 'woocommerce_bacs_process_payment_order_status', OrderStatus::ON_HOLD, $order ); // Mark as on-hold (we're awaiting the payment). $order->update_status( $process_payment_status, __( 'Awaiting BACS payment', 'woocommerce' ) ); } else { $order->payment_complete(); } // Remove cart. WC()->cart->empty_cart(); // Return thankyou redirect. return array( 'result' => 'success', 'redirect' => $this->get_return_url( $order ), ); }