I have a custom payment gateway where I need to reload checkout page if payment failed.
Reason:
When Card details submitted the payment gateway generates a card token which I need to process the payment but we can use the card token only once with a request.
What I need:
Currently, I am just showing the error message and a return when payment is failed.
if($payment_status['status']){
$order->update_status( 'on-hold', __( "ABC Payment Done\n", 'stackoverflow' ) );
wc_reduce_stock_levels($order_id);
WC()->cart->empty_cart();
return array(
'result' => 'success',
'redirect' => $this->get_return_url( $order )
);
}else{
wc_add_notice( $payment_status['message'] , 'error' );
return;
}
How can I reload/refresh the page if payment failed? S user can enter the card details again and we can process the payment. Or any other suggestion?
from How to reload checkout page if payment failed in Woocommerce
No comments:
Post a Comment