Authentication failed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
After following the smart button basic integration ; https://developer.paypal.com/docs/checkout/integrate/
with the SDK [PHP], i get this error in my console;
Fatal error: Uncaught exception 'PayPalHttp\HttpException' with message '{"error":"invalid_client","error_description":"Client Authentication failed"}'
I am sure my client ID and secret is fine.
client side ;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thank you for posting to the PayPal Merchant Technical Support Community.
Usually when you receive that error there are a few possible reasons:
- If you have done a var dump and you're 100% confident that the correct client id and secret are being passed in the other possibility is that your endpoints are set to PayPal Live and you are sending Sandbox Credentials. Make sure you are pointed to Sandbox Endpoints.
-
// 1b. Point your server to the PayPal API PAYPAL_OAUTH_API = 'https://api.sandbox.paypal.com/v1/oauth2/token/'; PAYPAL_ORDER_API = 'https://api.sandbox.paypal.com/v2/checkout/orders/';
-
- You are attempting a Direct Credit Card payment and not setup for Direct Credit Cards through Rest API (Direct Credit Cards through Rest API has been deprecated for new integrations at this time)
Thank you,
Jennifer
PayPal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I didnt set any endpoints, im using the createOrder and OnApprouve function in the Smart Button Integration example.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for replying!
This is where I would start with the debugging process:
<script src="https://www.paypal.com/sdk/js?client-id=MY-ID-HERE"></script>
Since you are testing, place your client id in the script tag and see if you can authenticate. This will be able to validate your client id to see if the issue is actually the value of the variable you added is not getting passed in to the script tag.
Also you may want to do a var dump to see what values are getting passed in.
Thank you,
Jennifer
PayPal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Jenifer.
Sorry for my English...
I've seen you responsed any posts about Authentication failed. I have a similar problem and I don't know if you prefer I quest it here or in a new post. I'll do that you think is better.
My problem is that I use some plugins to comunicate my page with PayPal, to make payments with credit card. In my Woocommerce shop.
All the plugin says I have to use API NVP/SOAP. I copy-paste my id and password. I try with sandbox or production, (correctly)
But ever, when I make a payment with credit card, is not possible. With all plugin, the log sais:
2020-04-18T19:49:10+00:00 INFO Got Http response code 401 when accessing https://api.paypal.com/v1/oauth2/token. [18-04-2020 19:49:10] PayPal\Core\PayPalHttpConnection : INFO: POST https://api.paypal.com/v1/oauth2/token [18-04-2020 19:49:11] PayPal\Core\PayPalHttpConnection : DEBUG: Request Headers : POST /v1/oauth2/token HTTP/1.1, Host: api.paypal.com, User-Agent: PayPalSDK/PayPal-PHP-SDK 1.14.0 (platform-ver=7.3.16; bit=64; os=Linux_3.10.0-714.10.2.lve1.5.17.1.el7.x86_64; machine=x86_64; crypto-lib-ver=1.1.1f; curl=7.69.1), Authorization: Basic eWVyYmFsaWZlX2FwaTEucm9tLmNhdDpLRkM3V1JUQjlCTE5DNkVR, Accept: */*, PayPal-Partner-Attribution-Id: Palmodule_SP, Content-Length: 29, Content-Type: application/x-www-form-urlencoded, , [18-04-2020 19:49:11] PayPal\Core\PayPalHttpConnection : DEBUG: Request Data : grant_type=client_credentials -------------------------------------------------------------------------------------------------------------------------------- [18-04-2020 19:49:11] PayPal\Core\PayPalHttpConnection : INFO: Response Status : 401 [18-04-2020 19:49:11] PayPal\Core\PayPalHttpConnection : DEBUG: Response Headers : Content-Type: application/json, Content-Length: 77, Connection: keep-alive, Date: Sat, 18 Apr 2020 19:49:12 GMT, Cache-Control: max-age=0, no-cache, no-store, must-revalidate, Paypal-Debug-Id: f5e9f97abccd9, X-Paypal-Token-Service: IAAS, Strict-Transport-Security: max-age=31536000; includeSubDomains, [18-04-2020 19:49:11] PayPal\Core\PayPalHttpConnection : ERROR: Got Http response code 401 when accessing https://api.paypal.com/v1/oauth2/token. {"error":"invalid_client","error_description":"Client Authentication failed"} [18-04-2020 19:49:11] PayPal\Core\PayPalHttpConnection : DEBUG:
Can you help-me please?
Thanks a lot.
Àngel

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Error message for obtaining access_token in REST APIs
- Google Pay SCA authentication dialog appears behind pay.google.com overlay in REST APIs
- NOT ENABLED TO VAULT PAYMENT SOURCE in Sandbox Environment
- p is not a function error using the example downloaded from Paypal in SDKs
- failed to pay with sandbox account in Sandbox Environment