I have a requirement to hide the shipping options on the paypal popup it's to a location I don't ship to. I have found this path that you can apparently set when you create the order, but I need to do it when they patch and some PayPal customers have multiple addresses.
/payment_source/paypal/experience_context/shipping_preference
I have tried to post:
{
"op": "replace",
"path": "/payment_source/",
"value": {
"paypal": {
"experience_context": {
"shipping_preference": "NO_SHIPPING"
}
}
But I just get an error back saying:
{"field":"value","location":"body","issue":"PATCH_VALUE_REQUIRED","description":"Please specify a 'value' to for the field that is being patched."},{"field":"path","value":"/payment_source/","location":"body","issue":"INVALID_JSON_POINTER_FORMAT","description":"Path should be a valid JSON Pointer https://tools.ietf.org/html/rfc6901 that references a location within the request where the operation is performed."}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation."
How can I do this and also return a Promise.reject() to make sure the user doesn't try to buy (this disables the complete button).
The alternative method I have thought, would be to hide the popup shipping options block using JS from the complete the final stage, is it possible to access the PayPal popup to show/hide elements on that popup? I just can't see a name to target that popup window if it's possible.
If you don't ship to an address, reject the promise.
That is all. No patching.