【问题标题】:Laravel 7: how to redirect to success page with Paypal after transaction?Laravel 7:交易后如何使用 Paypal 重定向到成功页面?
【发布时间】:2021-07-06 11:20:53
【问题描述】:

我在 Laravel 中尝试了一些新东西,如何在交易后将用户重定向到新视图“成功页面”,而不是使用脚本的标准警报?

        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: '0.10' // <---- totale
                }
              }]
            });
          },
          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.
              alert('Transaction completed by ' + details.payer.name.given_name);
            });
          }
        }).render('#paypal-button-container');
        //This function displays Smart Payment Buttons on your web page.
    </script>  ```

【问题讨论】:

    标签: laravel paypal


    【解决方案1】:

    在该特定功能中,您可以使用actions.redirect()

    一般的 JS 答案是将window.location.href 设置为新的目的地

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-07
      • 2014-07-15
      • 2012-06-02
      • 2021-04-26
      • 2018-11-24
      • 1970-01-01
      • 1970-01-01
      • 2020-08-28
      相关资源
      最近更新 更多