Paypal preapproval payment using embeded Light box

做~自己de王妃 提交于 2019-12-06 01:31:24

问题


I am working in embedded adaptive preapproval payment now the issue I am facing is how to implement preapproval payment using light box.

I have implemented pay action by setting paykey using light box its working good, but same the thing I have followed with little modification in code for preapproval request was not working light box get hangs up. kindly let me know what I am missing here.

HTML code:

<html>
<head>
    <script src="https://www.paypalobjects.com/js/external/dg.js" type="text/javascript"></script>
</head>

<body>
    <form action="https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/preapprovalkey" target="PPDGFrame" class="standard">
        <label for="buy">Buy Now:</label>
        <input type="image" id="submitBtn" value="Pay with PayPal" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif">
        <input id="type" type="hidden" name="expType" value="light">
        <input id="preapprovalkey" type="hidden" name="preapprovalkey" value="{{preapprovalkey}}">
    </form>
    <script type="text/javascript" charset="utf-8">
        var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });
    </script>
</body>
</html>

回答1:


The dg.js is outdated as PayPal is sunsetting the DG product, you would include the 'apdg.js' instead, and change the action URL from pay to preapproval

<html>

<head>
  <title>AP Redirection Demo</title>
  <script src="https://www.paypalobjects.com/js/external/apdg.js" type="text/javascript"></script>
</head>

<body>
  <form action="https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/preapproval" target="PPDGFrame" class="standard">
    <label for="buy">Pay Now:</label>
    <input type="image" id="submitBtn" value="Pay with PayPal" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif">
    <input id="type" type="hidden" name="expType" value="light">
    <input id="preapprovalkey" type="input" name="preapprovalkey" value="insert_preapproval_key">
  </form>
  <script type="text/javascript" charset="utf-8">
    var dgFlowMini = new PAYPAL.apps.DGFlowMini({
      trigger: 'submitBtn'
    });
  </script>

</body>

</html>


来源:https://stackoverflow.com/questions/16581647/paypal-preapproval-payment-using-embeded-light-box

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