【问题标题】:Redirect to a page after Paypal transactionPaypal 交易后重定向到页面
【发布时间】:2020-04-15 20:38:11
【问题描述】:

我做了解释的例子:

https://developer.paypal.com/docs/checkout/integrate/#2-add-the-paypal-javascript-sdk-to-your-web-page

<script>
  paypal.Buttons({
    createOrder: function(data, actions) {
      // This function sets up the details of the transaction, including the amount and line item details.
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '1.00'
          }
        }]
      });
    },

    onApprove: function(data, actions) {
      // This function captures the funds from the transaction.
      //actions.redirect();

      return actions.order.capture().then(function(details) {
        // This function shows a transaction success message to your buyer.

      });
    }




  }).render('#paypal-button-container');
  //This function displays Smart Payment Buttons on your web page.
</script>

但我想在交易被批准后将用户发送到其他页面。

我尝试使用:

onApprove: function(data, actions) {
      // This function captures the funds from the transaction.


      return actions.order.capture().then(function(details) {
        // This function shows a transaction success message to your buyer.
        actions.redirect("<url>");
      });
    }

没有成功。

知道如何设置重定向网址吗?

【问题讨论】:

    标签: javascript paypal


    【解决方案1】:

    你试过用这个吗?

    document.location.href = "www.your-redirect-page.com"

    【讨论】:

    • 我必须在哪里插入这个?
    • 你使用的相同位置 actions.redirect("&lt;url&gt;"); 我想
    猜你喜欢
    • 2021-07-06
    • 2017-01-07
    • 2013-10-08
    • 1970-01-01
    • 2016-01-09
    • 2013-03-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多