Laravel 7: 支付宝交易后如何跳转到成功页面?
Laravel 7: how to redirect to success page with Paypal after transaction?
我正在 Laravel 中尝试一些新东西,我如何在交易后将用户重定向到新视图“'success page'”,而不是使用脚本的标准警报?
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> ```
在那个特定的回调函数中,您可以使用 actions.redirect()
当前的 PayPal 演示现在有一个示例,其中注释为一个选项,而不是在 <div>
中显示消息的无重定向选项:https://developer.paypal.com/demo/checkout/#/pattern/client
一般的 JS 答案是将 window.location.href
设置为新的目的地
我正在 Laravel 中尝试一些新东西,我如何在交易后将用户重定向到新视图“'success page'”,而不是使用脚本的标准警报?
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> ```
在那个特定的回调函数中,您可以使用 actions.redirect()
当前的 PayPal 演示现在有一个示例,其中注释为一个选项,而不是在 <div>
中显示消息的无重定向选项:https://developer.paypal.com/demo/checkout/#/pattern/client
一般的 JS 答案是将 window.location.href
设置为新的目的地