cancel
Showing results for 
Search instead for 
Did you mean: 

PHP Orders V2 REST Receiving "RESOURCE_NOT_FOUND" when executing OrdersPatchRequest()

Options
punchmark
Contributor
Posted on

I create a simple order with the OrdersCreateRequest() function, passing in a reference_id which I get later using the OrdersGetRequest().

I receive the customer's shipping address from Paypal, calculate taxes and shipping cost, and issue a patch request using OrdersPatchRequest(). This works in my dev environment 100% of the time.

 

In production, I always receive RESOURCE_NOT_FOUND with reason INVALID_RESOURCE_ID. 

My orders only ever have one purchase unit, and for the path, I've tried

"path":"/purchase_units/@reference_id=='ref_zzz002186'/amount", // my actual reference ID for this purchase unit

"path":"/purchase_units/@reference_id=='default'/amount", // The supposed value when only one purchase unit exists

"path":"/purchase_units/@reference_id=='PUHF'/amount", // Taken from all Paypal documentation

 

Here is an example full patch request JSON: 

[{

    "op":"replace",

    "path":"\/purchase_units\/@reference_id=='ref_zzzz002186'\/amount",

    "value":{

       "currency_code":"USD",

       "value":18,

       "breakdown":{

          "item_total":{

             "currency_code":"USD",

             "value":10

          },

          "tax_total":{

             "currency_code":"USD",

             "value":0

          },

          "shipping":{

             "currency_code":"USD",

             "value":8

          }

       }

    }

}]

 

And the response:

{

"name":"RESOURCE_NOT_FOUND",

"details":[{

    "location":"path",

    "issue":"INVALID_RESOURCE_ID",

    "description":"Specified resource ID does not exist. Please check the resource ID and try again."

}],

"message":"The specified resource does not exist.",

"debug_id":"zyxxyz369ab9b",

"links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_RESOURCE_ID","rel":"information_link"..."}]

}

 

Where am I doing something wrong? What is a RESOURCE_ID?

 

Here is the OrdersGetRequest() Response:

{
    "statusCode": 200,
    "result": {
    "id": "zzz100811C357161W",
    "intent": "CAPTURE",
    "status": "APPROVED",
    "purchase_units": [{
       "reference_id": "ref_zzz002186",
       "amount": {
          "currency_code": "USD",
          "value": "18.00"
       },
...

}

 

I appreciate any help...

Haven't Found your Answer?

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