成功付款时打开特定的网址-贝宝按钮

加布里埃尔·巴班(Gabriel Baban)

我创建了智能贝宝按钮并获得了此代码

<div id="paypal-button-container"></div>
<script src="https://www.paypal.com/sdk/js?client-id=sb&currency=EUR" data-sdk-integration-source="button-factory"></script>
<script>
  paypal.Buttons({
      style: {
          shape: 'pill',
          color: 'gold',
          layout: 'vertical',
          label: 'buynow',
          
      },
      createOrder: function(data, actions) {
          return actions.order.create({
              purchase_units: [{
                  amount: {
                      value: '13.88'
                  }
              }]
          });
      },
      onApprove: function(data, actions) {
          return actions.order.capture().then(function(details) {
              alert('Transaction completed by ' + details.payer.name.given_name + '!');
          });
      }
  }).render('#paypal-button-container');
</script>

我想知道,是否有在成功付款后打开特定网址的功能,以在警报后添加onApprove功能?它会那样工作吗?

在这种情况下,window.open()是否可以工作?

迈克尔·韦杰夫

您要使用location.assign语法:

location.assign(url);

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章