So I’m building a custom payment gateway and am having trouble with redirecting to my external system when the checkout form is submitted.
I’ve read through the documentation at: https://docs.woocommerce.com/document/payment-gateway-api/ but it really isn’t very comprehensive, especially when working with external gateways.
I’ve managed to setup my payment gateway fine and have activated it and added my admin area fields by using my class to extend WC_Payment_Gateway.
The problem I’m having is when I submit the checkout page form, i need my site to redirect to the external payment system we’re using as well as passing through a custom built JSON array we’ve made. However, I cannot find where I’m supposed to put this external payment_url.
Does it go within the “process_payment” function?
I’ve used:
return array(
‘result’ => ‘success’,
‘redirect’ => $this->get_return_url( $order ),
);
But this just goes to “/checkout/order-received/” and a thank you page is shown. I’ve also tried:
wp_remote_post( $this->payment_url, $order_json);
But again, this doesn’t work. I really need some help please!