I have a gateway plugin and I added the code below to redirect the customer to a custom page when the payment fails.
My question is, do I need to add exit(); after the end of the redirect_url which is inside the if statement?
I have seen some codes with exit and some without.
else {
//failed
$this->msg['class'] = 'error';
$this->msg['message'] = __( "Your Transaction Has Failed Due to Some Technical Error. Please Try Again.<br/><br/>", 'toBeTranslatd');
$order->update_status('failed');
$order->add_order_note('Failed');
$order->add_order_note($this->msg['message']);
$redirect_url = home_url( '/payment-faild/' );
$lang_code = get_post_meta( $order_id, 'wpml_language', true );
if ( $lang_code === ar ) {
$redirect_url = apply_filters( 'wpml_permalink', $redirect_url, $lang_code );
//exit(); // Do I need this or delete it?
}
}