I'm integrating a WooCommerce payment gateway plugin and have a requirement to embed the gateway in an iframe. I'm redirecting with the below code to the Pay (the /order-pay route by default) endpoint where I'd like to include the iframe where the payment process will continue.
Does anyone know of an applicable hook in which I load the necessary JS scripts to initialise the iframe on the order-pay template?
function process_payment( $order_id ) {
global $woocommerce;
$order = new WC_Order( $order_id );
$order->update_status( 'pending-payment', __( 'Awaiting payment', 'some-domain' ) );
return array(
'result' => 'success',
'redirect' => $order->get_checkout_payment_url( $on_checkout = true )
);
}