Patch Order from Express button
Mittelwind
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Apr-26-2019
02:08 AM
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!
1 REPLY 1
Mittelwind
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr-26-2019
05:59 AM
Simple Solution: you must return the fetch if you are not returning action.resolve() or action.reject()
return fetch(....
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- When clicking on a payment button generates error: Unexpected token ... in PayPal Payments Standard
- How to redirect user to paypal checkout form for card payment? in PayPal Payments Standard
- Payment not automatically being captured, funds not transferred in Sandbox Environment
- How do i pass a customer ID number in the transaction in Sandbox Environment
- Sandbox always shows amount of transaction is 0.01 in Sandbox Environment