API - Where to find Order Id?

DenZed
Contributor
Contributor

Hi,

 

I am having trouble with the API for Orders. I have the following code in PHP and would like to retrieve the order info. The order was created using woocommerce's subscription plugin.

 

$ch = curl_init('https://api.sandbox.paypal.com/v2/checkout/orders/824);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Authorization: Bearer '.$access_token
));

$result = curl_exec($ch);

 

I am able to request and retrieve an access token but I get an error whenever I get to this code.

 

{"name":"RESOURCE_NOT_FOUND","details":[{"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":"cd668e38e28d9","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_RESOURCE_ID","rel":"information_link","method":"GET "}]}

 

In the sandbox business account transaction, here are the different IDs.

 

Transaction ID: 2D8522225D2047105

Invoice ID: WC-824

Custom: {"order_id":824,"order_key":"wc_order_v2JJlOLsPIPIx"}

 

I've tried the different IDs as substitute for the Order Id but I still get the same error. Any help would be appreciated.

 

Thank you.

 

Denz

 

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

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