Why does the PayPal API not recognize my client id and secret

dimpeeep
New Community Member

The Paypal API doesn't recognize my Client ID and Secret I got from https://developer.paypal.com/developer/applications/

I wanted to include a server side checkout according to this tutorial https://developer.paypal.com/docs/archive/checkout/how-to/server-integration/

When I do the request to https://api-m.paypal.com/v1/payments/payment I always get a 401 Error with the message "Authentication failed due to invalid authentication credentials or a missing Authorization header.". I checked multiple times if my credentials were correctly included into the request. I also tested the endpoint in my server environment and as well via Postman. I also tried the route https://api-m.sandbox.paypal.com/v1/oauth2/token/**bleep** to exchange my credentials with an access token and got the same problem. I also tried to create multiple Sandbox and Live Accounts and always got the same error.

Has anyone an idea what the problem could be?

Login to Me Too
1 REPLY 1

FazooAdmi
Contributor
Contributor

There are two separate issues here.

  1. You first need to use /v1/oauth2/token to obtain an access token, and then use that access token to call any of the other actual APIs.

  2. The credentials you obtain from PayPal Developer will be for either "Sandbox", or "Live". Make sure you choose the correct tab (sandbox, for development). Sandbox credentials will only work for api-m.sandbox.paypal.com , and Live credentials will only work for api-m.paypal.com . The two environments are completely separate.

If you still have issues, post the SANDBOX client ID and secret you are using, and the full request and response to the api-m.sandbox.paypal.com endpoint. There should be a PayPal-Debug-Id in any error response, in the headers if nowhere else.

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.