簡體   English   中英

重定向到 Paypal 事務后的頁面

[英]Redirect to a page after Paypal transaction

我做了解釋的例子:

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>");
      });
    }

沒有成功。

關於如何設置重定向 url 的任何想法?

你試過用這個嗎?

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM