6

我正在从事嵌入式自适应预批准支付,现在我面临的问题是如何使用灯箱实现预批准支付。

我已经通过使用灯箱设置支付密钥来实现支付操作,它的工作很好,但是我在代码中对预先批准请求的代码进行少量修改的情况下,灯箱挂断了。请让我知道我在这里缺少什么。

HTML 代码:

<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>
4

1 回答 1

0

由于 PayPal 正在淘汰 DG 产品,因此dg.js已过时,您将包含“apdg.js”,并将操作 URL 从更改paypreapproval

<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>

于 2016-02-24T03:17:59.113 回答