x

[ABUSE] By: pandawagon / Board: troubleshooting (28524)

Access


Link to post: (Request not authorized error)
pandawagon


https://www.sellercommunity.com/t5/Troubleshooting/Request-not-authorized-error/m-p/243927#M28524


Everything works fine for the sandbox, but I am getting a "Request not authorized error" when I switch over to my production credentials.   I set the application id and location id in my js code (please note that my real credentials are obscured by "xxx" below):   const paymentForm = new SqPaymentForm({ // Initialize the payment form elements applicationId: "xxx",   I used the production access token in my php code: $client = new SquareClient([ 'accessToken' => 'xxx', 'environment' => Environment::PRODUCTION ]);   $body2->setLocationId('xxx');     How come the code works for the sandbox environment but doesn't work when I change the environment to production and update my credentials?


This message has 0 replies


802 Views
Message 1 of 3
Report
2 REPLIES 2

Everything works fine for the sandbox, but I am getting a "Request not authorized error" when I switch over to my production credentials.

 

I set the application id and location id in my js code (please note that my real credentials are obscured by "xxx" below):

 

const paymentForm = new SqPaymentForm({
// Initialize the payment form elements
applicationId: "xxx",

 

I used the production access token in my php code:

$client = new SquareClient([
'accessToken' => 'xxx',
'environment' => Environment::PRODUCTION
]);

 

$body2->setLocationId('xxx');

 

 

How come the code works for the sandbox environment but doesn't work when I change the environment to production and update my credentials?

842 Views
Message 2 of 3
Report
Alumni

Have you tried updating your JS link to switch to production:

 

Changing this:

 

<script type="text/javascript" src="https://js.squareupsandbox.com/v2/paymentform"> </script>

 

to this:

 

<script type="text/javascript" src="https://js.squareup.com/v2/paymentform"> </script>

 

@tk1swify

 

 

Justin
Community Moderator, Square
Sign in and click Mark as Best Answer if my reply answers your question.
755 Views
Message 3 of 3
Report