RESOURCE_NOT_FOUND issue in both sandbox and live

liman
Contributor
Contributor

Hi Paypal Team,

 

My team keep getting INVALID_RESOURCE_ID in response once a while when trying to get order using the checkout version 2 rest apis.

Example is the response; 

 

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

 

Meanwhile the order id we are using was actually from paypal. We used this link ; https://developer.paypal.com/docs/checkout/integrate/#6-verify-the-transaction

The issue comes from  line , request = OrdersGetRequest(order_id) , order_id being the transaction id we get from paypal.

 

Can you please help?

 

Login to Me Too
34 REPLIES 34

rachidaitouais
Contributor
Contributor

I am using https://api.paypal.com/v1/oauth2/token  to get the token -> It works

 

And https://api.paypal.com/v2/checkout/orders/transactionid to get transaction details using transaction-id it doesn't work

 

Please find my API calls here http://snippi.com/s/kn42axj 

 

Thank you

Login to Me Too

rachidaitouais
Contributor
Contributor

here is the calls

 

 

<?php

$ch = curl_init();
$clientId = "my live sclientid";
$secret = "my live secret code";

//let's get the token
curl_setopt($ch, CURLOPT_URL, "https://api.paypal.com/v1/oauth2/token");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $clientId.":".$secret);
curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials");

$result = curl_exec($ch);

if(empty($result))die("Error: No response.");
else
{
$json = json_decode($result);
echo $json->access_token;

// calling the details function
$data = call_api($json->access_token) ;
}

//showing transaction details
var_dump( $data);

curl_close($ch);





function call_api($token){

$curl= curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.paypal.com/v2/checkout/orders/transactionid");
curl_setopt($curl, CURLOPT_POST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization: Basic ' . $token,
'Content-Type: application/json'
));
$response = curl_exec($curl);
$result = json_decode($response);

return $result;


}


?>

Login to Me Too

rachidaitouais
Contributor
Contributor

Hello!

 

Any updates, please!!

 

We have received too many unauthorized payments recently, so we really need to check the transaction details for the country of the payer to look if it is equal to  IP of the customer

 

Do you have any information on how to find the transaction details using the transaction id 

 

Thank you

Login to Me Too

rahul-dighe
PayPal Employee
PayPal Employee

And https://api.paypal.com/v2/checkout/orders/transactionid to get transaction details using transaction-id it doesn't work

 

is your transactionid a orderid or a captureid - can you put an actual request/response sample or else it's hard to understand as the devil is in what you use in the transactionid . it would be also good if you can put in the debug_id that is sent in the headers as part of the response.

 

I am not able to view this > Please find my API calls here http://snippi.com/s/kn42axj 

Senior Product Manager - PayPal Checkout API Product
Login to Me Too

rachidaitouais
Contributor
Contributor

I am using the transaction id please check this screenshot to see what I'm talking about, 

 

Screen Shot 2019-09-28 at 1.28.40 AM.jpg

 

 

Here is the debug id :  1e4db9e9c133f

 

I don't know why Paypal is adding some characters to the end of the URL http://snippi.com/s/kn42axj 

Just copy and past it in your browser and it will work. this link contains all API calls used to retrieve the transaction details,

 

Thank you

 

 

 

Login to Me Too

rachidaitouais
Contributor
Contributor

Hello!

 

Any updates please!!

Login to Me Too

rahul-dighe
PayPal Employee
PayPal Employee

The transaction_id is not the order ID hence you are getting a 404

 

When you do a Create Order you get back an "id" which is the Order ID. 

When you Capture an Order you also get back a "capture id" which is found within purchase_units.payments.captures.id

https://developer.paypal.com/docs/api/orders/v2/#definition-payment_collection

 

to view details do a v2/payments/captures/transaction-id

 

e.g.

{ "id": "5O190127TN364715T", "status": "COMPLETED", "payer": { "name": { "given_name": "John", "surname": "Doe" }, "email_address": "", "payer_id": "QYR5Z8XDVJNXQ" }, "purchase_units": [ { "reference_id": "d9f[Removed. Phone #s not permitted]pan>"shipping": { "address": { "address_line_1": "<removed>", "address_line_2": "<removed>", "admin_area_2": "San Jose", "admin_area_1": "CA", "postal_code": "95131", "country_code": "US" } }, "payments": { "captures": [ { "id": "3C679366HH908993F", "status": "COMPLETED", "amount": { "currency_code": "USD", "value": " .... 

Senior Product Manager - PayPal Checkout API Product
Login to Me Too

rachidaitouais
Contributor
Contributor

Thank you Rahul for your support!

 

make sense now! but v2/payments/captures/transaction-id doesn't return the information I want! I mean country code and payer ID...

 

Let's take this transaction id for example:

 

object(stdClass)#2064 (11) { ["id"]=> string(17) "62H53161XT978694N" ["amount"]=> object(stdClass)#2063 (2) { ["currency_code"]=> string(3) "USD" ["value"]=> string(5) "34.00" } ["final_capture"]=> bool(true) ["seller_protection"]=> object(stdClass)#2062 (2) { ["status"]=> string(8) "ELIGIBLE" ["dispute_categories"]=> array(2) { [0]=> string(17) "ITEM_NOT_RECEIVED" [1]=> string(24) "UNAUTHORIZED_TRANSACTION" } } ["seller_receivable_breakdown"]=> object(stdClass)#2058 (3) { ["gross_amount"]=> object(stdClass)#2061 (2) { ["currency_code"]=> string(3) "USD" ["value"]=> string(5) "34.00" } ["paypal_fee"]=> object(stdClass)#2053 (2) { ["currency_code"]=> string(3) "USD" ["value"]=> string(4) "1.56" } ["net_amount"]=> object(stdClass)#2057 (2) { ["currency_code"]=> string(3) "USD" ["value"]=> string(5) "32.44" } } ["invoice_id"]=> string(32) "ee8251a64ad0bd7775c0e0873876fd5a" ["custom_id"]=> string(6) "103551" ["status"]=> string(9) "COMPLETED" ["create_time"]=> string(20) "2019-09-30T20:14:58Z" ["update_time"]=> string(20) "2019-09-30T20:14:58Z" ["links"]=> array(3) { [0]=> object(stdClass)#2100 (3) { ["href"]=> string(61) "https://api.paypal.com/v2/payments/captures/62H53161XT978694N" ["rel"]=> string(4) "self" ["method"]=> string(3) "GET" } [1]=> object(stdClass)#2097 (3) { ["href"]=> string(68) "https://api.paypal.com/v2/payments/captures/62H53161XT978694N/refund" ["rel"]=> string(6) "refund" ["method"]=> string(4) "POST" } [2]=> object(stdClass)#2098 (3) { ["href"]=> string(59) "https://api.paypal.com/v2/checkout/orders/89X32207S5254462U" ["rel"]=> string(2) "up" ["method"]=> string(3) "GET" } } }

 

And when I call this URL with GET method  https://api.paypal.com/v2/checkout/orders/89X32207S5254462U

 

-RESOURCE_NOT_FOUND-

object(stdClass)#2064 (5) { ["name"]=> string(18) "RESOURCE_NOT_FOUND" ["details"]=> array(1) { [0]=> object(stdClass)#2063 (2) { ["issue"]=> string(19) "INVALID_RESOURCE_ID" ["description"]=> string(81) "Specified resource ID does not exist. Please check the resource ID and try again." } } ["message"]=> string(38) "The specified resource does not exist." ["debug_id"]=> string(13) "bc468d62b5934" ["links"]=> array(1) { [0]=> object(stdClass)#2062 (3) { ["href"]=> string(74) "https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_RESOURCE_ID" ["rel"]=> string(16) "information_link" ["method"]=> string(3) "GET" } } }

 

There is another transaction ID that returns https://api.paypal.com/v2/checkout/orders/EC-NUMBERSXXXX   When I call it with GET method it returns all data I want. payer id country code address....

 

It seems like only the order id that returns all payer data, so how can I find order_id using the transaction id, or if there is another method to get all payer data using Transaction id

 

Sorry for bothering you

 

Thank you so much 

 

 

Login to Me Too

rachidaitouais
Contributor
Contributor

I just figured out what happened

 

I have two websites: one with Paypal stand and the other with Paypal express 

 

/v2/payments/captures/transaction_id  made with Paypal standard returns this URL  https://api.paypal.com/v2/checkout/orders/XXXXXXXXXX

 

/v2/payments/captures/transaction_id  made with Paypal express returns  https://api.paypal.com/v2/checkout/orders/EC-XXXXXXXXXXXX

 

So I am able to find transactions details using the transaction_id made with Paypal express.

 

Thank you 

 

 
Login to Me Too

cartmanila
Contributor
Contributor

Hello Also having they same issue.

 

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

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.