i am following this tutorial Woocommerce Payment Gateway
but instead of direct, i am doing form method. For this, I have used webhook using
add_action( 'woocommerce_api_vista_response', array( $this, 'vistaMoneyResponseWebhook' ) );
and my vistaMoneyResponseWebhook is as follows:
public function vistaMoneyResponseWebhook() {
$order = wc_get_order( $_GET['trackid'] );
//var_dump($order);
if($_GET['responsecode']==='000') {
$order->payment_complete();
//$order->reduce_order_stock();
wc_reduce_stock_levels( $order->get_id() );
}
else{
//$order->
var_dump($_GET);die;
}
update_option('webhook_debug', $_GET);
}
The response from payment gateway is in $_GET. and this code works fine.
Now, I am stuck in redirecting the user to the corresponding nice pages like order successful and unsuccessful pages. Need guidance in that scenario.