[英]Remove shipping address from paypal express checkout
I am using express checkout in my website.我在我的网站上使用快速结账。 I want to disable shipping address from it while completing the transaction.
我想在完成交易时禁用它的送货地址。 i am using script on a button.
我在按钮上使用脚本。 Piece of code that i am using is this.
我正在使用的一段代码是这样的。
paypal.Button.render({
env: 'production', // sandbox | production
client: {
sandbox: 'mykey',
production: 'mykey'
},
// Show the buyer a 'Pay Now' button in the checkout flow
commit: true,
// payment() is called when the button is clicked
payment: function(data, actions) {
// Make a call to the REST api to create the payment
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '5.00', currency: 'EUR' }
}
]
}
});
},
// onAuthorize() is called when the buyer approves the payment
onAuthorize: function(data, actions) {
// Make a call to the REST api to execute the payment
return actions.payment.execute().then(function() {
window.location = "address";
});
}
}, '#paypal-button-container');
Help will be really appreciated.Thanks帮助将不胜感激。谢谢
In case you are still looking for a solution the shipment address can be disabled by adding the following lines:如果您仍在寻找解决方案,可以通过添加以下行来禁用发货地址:
experience: {
input_fields: {
no_shipping: 1
}
}
So your code needs to be adjusted like this:所以你的代码需要像这样调整:
...
// Make a call to the REST api to create the payment
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '5.00', currency: 'EUR' }
}
],
experience: {
input_fields: {
no_shipping: 1
}
}
}
});
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.