I am developing wordpress plugin for Woocommerce payment.
As I can see I have to extend WC_Payment_Gateway and implement method “process_payment“. I have looked into some examples and found that this method should return something like:
array( 'result' => 'success', 'redirect' => $redirectUrl );
and then control is returned to WC_Checkout which will redirect to provided url.
Problem is that our payment provider requires to submit form to his page instead of redirect. Having that API restriction in mind I am asking what is the best way to connect with my payment provider?
Should I introduce one layer more and make small web app which will act as intermediate between Woocommerce and payment provider?
In such case this could be the flow inside process_payment:
1. Prepare and send all order data to intermediate payment app. This will return unique url.
2. Redirect to that url
3. On redirected page submit data to payment provider(using curl od guzzle for example)
4. Implement hook inside gateway classes and call payment_complete from this hook, empty cart and clear session
So my question is is this good way to do it or there are some more elegant way?