SagePay Direct 3DSecure checkout part returning blank page when redirecting out to bank

浪尽此生 提交于 2019-12-24 00:33:51

问题


I am fairly new to SagePay so some advice on this would be great. I am beyond the part where you insert your card details, in fact im at the step after this where SagePay is demanding 3DSecure password validation.

Now the docs specify that we need a form that submits automatically to the ACSURL consisting of the PaReq and MD fields (via post).

Below is an image of what my output is.

Now this looks just like any demo ones provided by any of the sagepay kits for this particular step and when the form is submitted I expect to be redirected to a form to fill out at this url: https://test.sagepay.com/mpitools/accesscontroler?action=pareq

However, all i'm receiving is a blank white screen if i send the form manually (out of an iframe) and a 404 whenever the form submits automatically within an iframe.

Am I missing something here? As I should be at the password insert section before the kickback to allow me to update the order to being completed.

Here is where I call my IFrame in my view file:

<div class="row">
    <div class="col-xs-12">
        <iframe src="/cart/iframe?ACSURL=<?=trim(htmlentities($ACSURL))?>&PaReq=<?=trim(htmlentities($PaReq))?>&vendorTxCode=<?=$vendorTxCode?>&MD=<?=trim(htmlentities($MD))?>" name="3DIFrame" id="3DIFrame" width="100%" height="500" frameborder="0"></iframe>
    </div>
</div>

If it helps here is the code I pass into my IFrame:

<script>
    function OnLoadEvent() {
        document.form.submit();
    }
</script>
<html>
    <head>
        <title>3D Secure Verification</title>
    </head>
    <body OnLoad="OnLoadEvent()">
        <form name="cardToken" action="<?=$_GET['ACSURL']?>" method="post">
            <input type="hidden" name="MD" value='<?=$_GET['MD']?>' />
            <input type="hidden" name="PaReq" value='<?=$_GET['PaReq']?>' />
            <input type="hidden" name="TermUrl" value='<?=trim(htmlentities('http://localhost/cart/complete_3d?vendorTxCode='.$_GET['vendorTxCode']))?>' />
            <button type="submit btn btn-primary">Submit</button>
            <noscript>
                <div style="text-align: center; margin: 0 auto;">
                    <p>Please click button below to Authenticate your card</p>
                    <input type="submit" value="Go"/>
                </div>
            </noscript>
        </form>
    </body>
</html>

Thanks


回答1:


You've got spaces in your PaReq field - replace them with +




回答2:


Your server assumes that the parameters in the querystring are encoded, so it's converting the "+" signs in PaReq to spaces.

Solution: Use urlencode instead of htmlentities.

<div class="row">
    <div class="col-xs-12">
        <iframe src="/cart/iframe?ACSURL=<?=trim(urlencode($ACSURL))?>&PaReq=<?=trim(urlencode($PaReq))?>&vendorTxCode=<?=$vendorTxCode?>&MD=<?=trim(urlencode($MD))?>" name="3DIFrame" id="3DIFrame" width="100%" height="500" frameborder="0"></iframe>
    </div>
</div>


来源:https://stackoverflow.com/questions/35657082/sagepay-direct-3dsecure-checkout-part-returning-blank-page-when-redirecting-out

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!