Hello,
I stuck with a problem I can not resolve by my own.
On address change I fetch a method server side which updates order items for the payment. This works, because I get the change on every second request (if i change back the address I get the result from the server side patch)
Because the popup window seems to not know, that the payment is already patched serverside, I trying to force a patch client side (intent)
onShippingChange: function(data, actions) {
fetch('/paypal/recalculate', {
method: 'post',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify(data)
}).then(response=>response.text()).then(
data=>{
return actions.order.patch([
{'op': 'replace',
'path': 'intent',
'value': 'sale'}
]);
//console.log(data);
});
},
This results in
stack: "Payment could not be patched, error occured in API call.
with a traceback which says nothing
Any help welcome!
... View more