Laravel 5 paypal/rest api sdk php没有自动重定向功能
在我的laravel 5.8应用程序中实现paypal 查看代码片段: 我不知道哪一个是返回有效格式的 这里 我发现必须使用重定向URL,因此我的按钮定义为:Laravel 5 paypal/rest api sdk php没有自动重定向功能,laravel-5,paypal-sandbox,Laravel 5,Paypal Sandbox,在我的laravel 5.8应用程序中实现paypal 查看代码片段: 我不知道哪一个是返回有效格式的 这里 我发现必须使用重定向URL,因此我的按钮定义为: <script> paypal.Button.render({ // Configure environment env: '
<script>
paypal.Button.render({
// Configure environment
env: 'sandbox',
client: {
sandbox: 'CLIENTID',
production: 'demo_production_client_id'
},
// Customize button (optional)
locale: 'en_US',
style: {
size: 'small',
color: 'blue',
shape: 'pill',
},
commit: true,
payment: function(data, actions) {
return actions.payment.create({
"note_to_payer": "Contact us for any questions on your order.",
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
redirect_urls : { //redirect_urls
return_url : 'https://www.votes.nilov-sergey-demo-apps.tk/paypal_payment',
cancel_url : 'https://www.votes.nilov-sergey-demo-apps.tk/paypal_payment_cancel'
},
transactions: [{
amount: {
total: '0.01',
currency: 'USD'
}
}]
});
},
// Execute the payment
onAuthorize: function(data, actions) {
console.log("onAuthorize data::")
console.log( data )
console.log("onAuthorize actions::")
console.log( actions )
return actions.payment.execute().then(function() {
// Show a confirmation message to the buyer
window.alert('Thank you for your purchase! 0');
});
}
}, '#paypal-button');
</script>
已修改:
当payment var创建并返回一个:
payment: function(data, actions) {
var payment = actions.payment.create({
"note_to_payer": "Contact us for any questions on your order.",
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
redirect_urls : { //redirect_urls
return_url : 'https://www.votes.nilov-sergey-demo-apps.tk/paypal_payment',
cancel_url : 'https://www.votes.nilov-sergey-demo-apps.tk/paypal_payment_cancel'
},
transactions: [{
amount: {
total: '0.01',
currency: 'USD'
}
}]
});
console.log("payment payment::")
console.log(payment);
// alert( "::"+var_dump(-88) )
return payment;
},
及特别警告:
Firefox can’t establish a connection to the server at wss://www.votes.nilov-sergey-demo-apps.tk/app/123?protocol=7&client=js&version=4.3.1&flash=false. app.js:1767:16
The connection to wss://www.votes.nilov-sergey-demo-apps.tk/app/123?protocol=7&client=js&version=4.3.1&flash=false was interrupted while the page was loading.
带有控制台付款输出和错误消息的printscreen如下所示:
是什么导致了这些错误?请查看我的网站上的paypal with sanbox live:打开并单击我看到的“感谢您的购买!”消息,无任何重定向。这可能是我的paypal应用程序的问题一些选项丢失或我登录到应用程序的帐户?请查看修改后的区块。您可以在我的网站上使用sanbox查看paypal live:打开并单击我看到“感谢您的购买!”消息,并且没有任何重定向。这可能是我的paypal应用程序的问题一些选项丢失或帐户我登录到应用程序?请查看修改块
Firefox can’t establish a connection to the server at wss://www.votes.nilov-sergey-demo-apps.tk/app/123?protocol=7&client=js&version=4.3.1&flash=false. app.js:1767:16
The connection to wss://www.votes.nilov-sergey-demo-apps.tk/app/123?protocol=7&client=js&version=4.3.1&flash=false was interrupted while the page was loading.