Example question title: Why am I getting a 401 unauthorized?

This is an example question to guide you as you start asking questions!

  • Make sure your title and description are descriptive and include what you are trying to achieve and what you’ve already tried.
  • Make sure you provide what SDK or API you’re using along with the version number.
  • Make sure you include environment-specific information such as OS / Language Runtime / etc.
  • Make sure you are not asking a duplicate question. Repeat questions water down information across multiple posts and create additional work for the community. Always check to see if your questions have been asked previously.

The 401 unauthorized error is typically due to an invalid (or possibly even missing) access token made in your API request. Please be sure that your request includes a valid access token in the Authorization header. Please also note that if you’re using sandbox, that the domain should be “https://connect.squareupsandbox.com” instead of “https://connect.squareup.com”, which can also cause this error. For more information about setting this header, take a look at our doc site.

Hello, I am having this exact error and all my credentials is correct.

I have a form on my WordPress built website

https://handsfreeluggage dot com/appointment-booking/

in which I am trying to use Square to recieve payment.

However, when I try to pay it pops a “REQUEST NOT AUTHORIZED” error as I input the following test card details.

Test Credentials :
Card Number : {{redacted}}
Card CVV : 111
Card Expiration : 08/2024
Card Postal Code : 44101

On my backend section on my website in Square, I used the following test credentials.

Location ID :- LN0ZPJ72GAFD3

Please help !!!