-->

贝宝自适应支付的移动网络(Paypal Adaptive payment for mobile we

2019-06-24 04:31发布

林集成贝宝自适应支付API的移动网站。 但是,当林提交付款

https://www.paypal.com/webscr?cmd=_ap-payment&paykey=value

(对于沙盒: https://www.sandbox.paypal.com/cgi-bin/webscr )

它总是重定向到贝宝的主要网站。 不要PayPal手机支付网站。 如何客户端重定向到PayPal移动网络?

Answer 1:

尝试重定向您的网站

https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?paykey=AP-XYZ&expType=mini

填写您的付款密钥到位AP-XYZ的

让我知道,如果它的工作原理。



Answer 2:

我发现最好的办法是迷你浏览器体验。 但我不得不执行它的各种移动设备上的不同的问题(这是它首先意味着)。 您将看到有关自适应支付和所有使用收藏夹和迷你浏览器体验各种各样的问题上有许多类似的问题。

但最后......我向天在几小时,几天小时后想通了! 这应该解决所有不同品种的所有人的问题,当谈到与贝宝自适应付款,并与问题的问题:

  1. 默认重定向贝宝网页不适合移动响应,看起来可怕的移动设备上。
  2. 灯箱被“挂了”,并没有关闭在某些移动设备。
  3. 迷你浏览器完成支付或取消后不会关闭。
  4. 迷你浏览器不重定向到callbackFunction参数来自PayPal apdg.js脚本。
  5. 不重定向到RETURNURL和cancelUrl支付完成后(或取消时)
  6. iOS版Google Chrome(iPhone手机)不会启动callbackFunction参数,因此支付完成或取消后,它只是让你在你的页面推出了支付宝付款页面从阻止你确认支付成功或失败。

击鼓请....在这里它是! 这取代任何需要的PayPal JavaScript文件等,所有你需要的是什么下面是你自己获得PayKey添加到重定向URL的方法一起。 我的直播网站,与自适应支付正常工作使用下面的代码,是https://www.trackabill.com 。

<div>
    <?php $payUrl = 'https://www.paypal.com/webapps/adaptivepayment/flow/pay?expType=mini&paykey=' . $payKey ?>

    <button onclick="loadPayPalPage('<?php echo $payUrl; ?>')" title="Pay online with PayPal">PayPal</button>
</div>
<script>
    function loadPayPalPage(paypalURL)
    {
        var ua = navigator.userAgent;
        var pollingInterval = 0;
        var win;
        // mobile device
        if (ua.match(/iPhone|iPod|Android|Blackberry.*WebKit/i)) {
            //VERY IMPORTANT - You must use '_blank' and NOT name the window if you want it to work with chrome ios on iphone
                //See this bug report from google explaining the issue: https://code.google.com/p/chromium/issues/detail?id=136610
            win = window.open(paypalURL,'_blank');

            pollingInterval = setInterval(function() {
                if (win && win.closed) {
                    clearInterval(pollingInterval);
                    returnFromPayPal();
                }
            } , 1000);
        }
        else
        {
            //Desktop device
            var width = 400,
                height = 550,
                left,
                top;

            if (window.outerWidth) {
                left = Math.round((window.outerWidth - width) / 2) + window.screenX;
                top = Math.round((window.outerHeight - height) / 2) + window.screenY;
            } else if (window.screen.width) {
                left = Math.round((window.screen.width - width) / 2);
                top = Math.round((window.screen.height - height) / 2);
            }

            //VERY IMPORTANT - You must use '_blank' and NOT name the window if you want it to work with chrome ios on iphone
                //See this bug report from google explaining the issue: https://code.google.com/p/chromium/issues/detail?id=136610
            win = window.open(paypalURL,'_blank','top=' + top + ', left=' + left + ', width=' + width + ', height=' + height + ', location=0, status=0, toolbar=0, menubar=0, resizable=0, scrollbars=1');

            pollingInterval = setInterval(function() {
                if (win && win.closed) {
                    clearInterval(pollingInterval);
                    returnFromPayPal();
                }
            } , 1000);
        }
    }

    var returnFromPayPal = function()
    {
       location.replace("www.yourdomain.com/paypalStatusCheck.php");
        // Here you would need to pass on the payKey to your server side handle (use session variable) to call the PaymentDetails API to make sure Payment has been successful
        // based on the payment status- redirect to your success or cancel/failed page
    }
</script>


Answer 3:

其实有一个简单的解决方案,这是不记录任何地方。 我们在讨论与贝宝有关添加这一段时间回来,所以我想知道是否最终得到实施。

不管怎么说,只是简单地将用户重定向到下面的网址,他们将被重定向到你的网站上完成:

https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/preapproval?preapprovalKey=PA-XXXXX&expType=redirect

这里的区别是使用expType=redirect宁可expType=mini 。 我不知道这个时候加入,但有点逆向工程和一些实验后,我们有一个非常简单的解决方案。



Answer 4:

这是正确的 - 自适应付款UI不是针对移动设备优化。 但最接近它提供的是我们所说的迷你浏览体验。 你可以试试,看看是否能提供您的需求。 你可以找到如何到这里指导X.com: 实施迷你浏览器选项



文章来源: Paypal Adaptive payment for mobile web