cancel
Showing results for 
Search instead for 
Did you mean: 

payment_id can be fake in REST API /v1/payments/payment/{payment_id}

New Community Member

payment_id can be fake in REST API /v1/payments/payment/{payment_id}

I use PayPal-Java-SDK to call REST API /v1/payments/payment/{payment_id} to get payment details. The code is:

 

 

Payment payment = Payment.get(apiContext, paymentId);

I used valid paymentId: PAY-6J516405S23367429LP6IYLQ and it was working as expected. I got the details about PAY-6J516405S23367429LP6IYLQ payment.

 

I changed the last sign in paymentId from Q to R to see how an error looks like when invalid paymentId is used. But I didn't get the error. The returned JSON was mostly the same like for PAY-6J516405S23367429LP6IYLQ.  The only one difference was paymentId in lines:

 

Spoiler

 "id": "PAY-6J516405S23367429LP6IYLR",

"parent_payment": "PAY-6J516405S23367429LP6IYLR",

"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-6J516405S23367429LP6IYLR",

 

The data were the same including transaction id:

 

transactions[0].related_resources[0].sale.id

 

I retested but this time for PAY-6J516405S23367429LP6IYLS and PAY-6J516405S23367429LP6IYLT and nothing changed. Still I got JSON data for PAY-6J516405S23367429LP6IYLQ.

Only when I changed paymentId to PAY-6J516405S23367429LP6IYLP I got the following error: 

 

Spoiler
response-code: 404    details: name: INVALID_RESOURCE_ID    message: Requested resource ID was not found.

 

It happened in sandbox.

Could you explain me why is that?

Thank you in advance for help.