英文:
Paypal Location Issue with @paypal/react-paypal-js
问题
I have a problem with paypal integration to my react project.
Actually I have implemented the paypal with this code.
const onCreateOrder = (data, actions) => {
return actions.order.create({
intent: "CAPTURE",
application_context: {
shipping_preferences: "NO_SHIPPING",
},
purchase_units: [
{
amount: {
value: 150,
},
},
],
});
};
But with this code, users can't input address on paypal platform. So I updated the code like this.
const onCreateOrder = (data, actions) => {
return actions.order.create({
intent: "CAPTURE",
application_context: {
shipping_preferences: "GET_FROM_FILE",
},
purchase_units: [
{
amount: {
value: 150,
},
},
],
});
};
Then I get this error on paypal.
This is the screenshot.
Could you please help me here?
Thank you.
I tried to change the address several times but not working.
英文:
I have a problem with paypal integration to my react project.
Actually I have implemented the paypal with this code.
const onCreateOrder = (data, actions) => {
return actions.order.create({
intent: "CAPTURE",
application_context: {
shipping_preferences: "NO_SHIPPING",
},
purchase_units: [
{
amount: {
value: 150,
},
},
],
});
};
But with this code, users can't input address on paypal platform. So I updated the code like this.
const onCreateOrder = (data, actions) => {
return actions.order.create({
intent: "CAPTURE",
application_context: {
shipping_preferences: "GET_FROM_FILE",
},
purchase_units: [
{
amount: {
value: 150,
},
},
],
});
};
Then I get this error on paypal.
This is the screenshot.
Could you please help me here?
Thank you.
I tried to change the address several times but not working.
答案1
得分: 1
屏幕截图中的错误发生在存在一个onShippingChange
回调函数被拒绝的时候(未成功返回)。
该回调函数的文档在此。如果您不需要它,请从您的按钮组件中删除它的定义。如果您确实需要它,请调试并修复以使其正常工作。
英文:
The error in the screenshot occurs when there is an onShippingChange
callback function that rejects the promise (does not return successfully).
The callback function is documented here. If you do not need it, remove its definition from your buttons component. If you do need it, debug and correct it to work as it should.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论