![](/img/trans.png)
[英]Paypal Smart Button: how to redirect to a PHP page after successfull payment?
[英]How to redirect user after to another page using PayPal smart buttons
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name + '!');
location.href="mywebsite";
});
},
我一直试图找出如何做到这一点,我也尝试过“location.replace()”,但它仍然没有用。 我想在接受付款后重定向用户。 警报功能确实有效,但仅在沙箱中,当我尝试在我的真实站点上使用它时,警报和重定向不起作用。 我正在使用 Google 协作平台,这可能是个问题吗? 这只是您在创建 PayPal 智能按钮时获得的基本代码,我添加的只是“location.href”,但它不会重定向我。 我会尽力回答任何问题! 感谢您对此事的任何帮助!
在您的 .then .then()
function 中,使用actions.redirect()
或设置window.location.href
我发现它有什么问题,它试图将 PayPal window 转入网站,但 window 会在我发现错误之前关闭!
我知道这是一个旧帖子,但这对我有用:
window.location.replace('https://website.com');
使用 PayPal 设置自动返回
要设置自动返回:
登录 paypal 并单击配置文件。 单击销售偏好下的网站支付偏好链接。 单击打开单选按钮以启用自动返回。 输入返回 URL。 注意:您必须满足返回 URL 要求才能设置自动返回。 详细了解退货 URL。
发送框表单多个返回请求 URL:如果您使用不同的 URL 来表示成功/失败
它将自动覆盖 paypal 指定的 URL。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.