VirdianX
VirdianX

Reputation: 21

PayPal Rest API Get Sale - REQUIRED_SCOPE_MISSING

Today I have been trying to implement the rest API into my application to look up transaction information from a transaction ID (GET /v1/payments/sale/)

I have implemented everything correctly on my end and set the mode to "live" and I can't seem to get details from a transaction.

Here is the full error code:

{"name":"REQUIRED_SCOPE_MISSING","message":"Access token does not have required scope","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#REQUIRED_SCOPE_MISSING"}

And here is documentation on what I am trying to do: https://developer.paypal.com/docs/api/#look-up-a-sale

Any help would be appreciated.

Thanks.

Upvotes: 0

Views: 761

Answers (2)

Jordan Reddick
Jordan Reddick

Reputation: 456

When I had this issue, the problem was that I was making REST requests using the Identity API token. Basically, I was logging users into my website with Paypal then using that token for REST requests when another token from the REST API service should have been used. "

Here is the support ticket from Paypal SDK deveoper Randy who helped answer my question even though I do not use the SDK. Thanks Randy:

https://github.com/paypal/PayPal-PHP-SDK/issues/785#issuecomment-282749095

Upvotes: 0

Jay Patel - PayPal
Jay Patel - PayPal

Reputation: 1489

There are few things you could do to make sure your configurations are set right.

  1. If the mode is set to live, are you using the live credentials instead of sandbox. You can select the sandbox app and copy the live credentials from there. See bottom part of this image.

enter image description here

  1. Make sure Payments are enabled on live. PayPal has a dashboard page, where you could see all the services that you have enabled to work with Live environment. This prevents accidents on unknowingly using an API on live. You can check the status here

enter image description here

  1. Is the sale that you are looking for created by the same clientId that you are using for making a GET call ? Only the app who creates the sale, can view the sale.

  2. In the mean time, PayPal has created SDKs for many languages to support REST APIs. They are actively developed, and maintained, and could help you mitigate issues in handling tokens, credentials, etc, and allows you to quickly use APIs faster and in a way that could be upgraded easily. Also, few SDKs come packaged with Sample codes, and wiki documentations. Few are still under development, but you can feel free to contribute back to these open source SDKs.

Upvotes: 1

Related Questions