v2 - update/patch Order - INVALID_JSON_POINTER_FORMAT

fra105
Contributor
Contributor

I feel stupid. No one else seems to have this problem.

I want to replace "purchase_units". According to the docs it can be replaced. But it is not working. Patching a single property of purchase_units is also not working.

 

Request:

 

curl -v -X PATCH <a href="https://api.sandbox.paypal.com/v2/checkout/orders/ORDER_ID/" target="_blank">https://api.sandbox.paypal.com/v2/checkout/orders/ORDER_ID/</a> -H "Content-Type: application/json" -H "Authorization: Bearer ACCESS_TOKEN" -d '[{"op":"replace","path":"/purchase_units/@reference_id=='default'","value":[{"amount":{"currency_code":"EUR","value":"11.22"}}]}]'

 

 

Response:

 

{"name":"UNPROCESSABLE_ENTITY","details":[{"field":"path","value":"/purchase_units/@reference_id==default","location":"body","issue":"INVALID_JSON_POINTER_FORMAT","description":"Path should be a valid JSON Pointer <a href="https://tools.ietf.org/html/rfc6901" target="_blank">https://tools.ietf.org/html/rfc6901</a> 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.","debug_id":"b25a467e2950a","links":[{"href":"<a href="https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_JSON_POINTER_FORMAT","rel":"informati..." target="_blank">https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_JSON_POINTER_FORMAT","rel":"informati...>"}]}

 

 

The example in the docs is also not working. invoice_id is being patched but the value passed is an object with the property integration_artifact?? This makes no sense. invoice_id should be a string.

 

Please help ;(

Login to Me Too
12 REPLIES 12

gcpman
Contributor
Contributor

Thanks. This worked.

However I'm now dealing with an issue where clicking the cart at the top to view the items refreshes the Iframe and removes my shipping selection options. If I change my shipping the options reload. I get a receive::req checkClose() event when clicking the cart

Login to Me Too

LeviPike
Contributor
Contributor

I am having trouble on this end, too. When I want to patch an order I always receive 

REFERENCE_ID_NOT_FOUND

as an error. It does not matter, if I use 'defaul', the orders internal refrence id or the paypal transactionId as reference_id. The answer is always the same. 

Here is the call:

 

 

 

[{
    "op": "replace",
    "path": "\/purchase_units\/@reference_id=='default'",
    "value": [{
        "reference_id": "2295037",
        "description": "Your order at Shop",
        "custom_id": "Shop Id 2295037",
        "soft_descriptor": "Shopname",
        "invoice_id": "2295037",
        "amount": {
            "currency_code": "EUR",
            "value": 59.98,
            "breakdown": {
                "item_total": {
                    "currency_code": "EUR",
                    "value": 50.4
                },
                "shipping": {
                    "currency_code": "EUR",
                    "value": 0
                },
                "discount": {
                    "currency_code": "EUR",
                    "value": 0
                },
                "tax_total": {
                    "currency_code": "EUR",
                    "value": 9.58
                }
            }
        },
        "items": [{
            "name": "Product 1",
            "description": "Product Descr. 1",
            "sku": "1019879",
            "unit_amount": {
                "currency_code": "EUR",
                "value": 16.8
            },
            "tax": {
                "currency_code": "EUR",
                "value": 3.19
            },
            "quantity": "1",
            "category": "PHYSICAL_GOODS"
        }, {
            "name": "Product 2",
            "description": "Product Descr. 2",
            "sku": "1024593",
            "unit_amount": {
                "currency_code": "EUR",
                "value": 33.61
            },
            "tax": {
                "currency_code": "EUR",
                "value": 6.38
            },
            "quantity": "1",
            "category": "PHYSICAL_GOODS"
        }],
        "shipping": {
            "name": {
                "full_name": "John Doe"
            },
            "address": {
                "address_line_1": "Badensche Str. 24",
                "address_line_2": "",
                "admin_area_2": "Berlin",
                "postal_code": "10715",
                "country_code": "DE"
            }
        }
    }]
}]

 

 

 

 

And the reply is always: REFERENCE_ID_NOT_FOUND

Login to Me Too

LeviPike
Contributor
Contributor

Turned out, that I made a mistake by accidently sending value as an array of objects (should be object only)

 

Using the provided shops orderId as reference in the path worked then:

 

 

    "path": "\/purchase_units\/@reference_id=='2295037'",    
    "value": {
        "reference_id": "2295037",

 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.