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.
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.