gpt4 book ai didi

paypal - 从 Paypal express 结账中删除送货地址

转载 作者:太空宇宙 更新时间:2023-11-03 15:54:19 25 4
gpt4 key购买 nike

我在我的网站上使用快速结帐。我想在完成交易时从中禁用送货地址。我在按钮上使用脚本。我正在使用的一段代码是这样的。

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');

非常感谢您的帮助。谢谢

最佳答案

如果您仍在寻找解决方案,可以通过添加以下行来禁用送货地址:

experience: {
input_fields: {
no_shipping: 1
}
}

所以你的代码需要这样调整:

...
// 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
}
}
}
});
...

关于paypal - 从 Paypal express 结账中删除送货地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52199857/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com