on the failure page, change the following code:
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") {
header("location: http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
die();
}
to:
/*if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") {
header("location: http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
die();
}*/