GET Order sending UNAUTHORIZED but not captured in logs

Hi, we have an odd case where a customer is unable to complete transactions with us via the Point of Sale system. The basics of how this works:

  1. Customer initiates transaction in our web application
  2. The Square app is presented and the payment is completed
  3. The application returns and a webhook is hit on our server to complete the transaction on our end (via payment.update hook)

This process is working for other customer but this one customer seems to have issues. We can see that the hook is hitting us, but when we try to preform a call to the retrieve Order API endpoint, we are getting a 401 or UNAUTHORIZED. The permissions are set up correctly to use the Orders API. I have manually created a simulation of what happens in the hook to see if I can observer the UNAUTHORIZED occurring for this customer but when I do this it works as expected and I get the order back.

I have two questions:
The UNAUTHORIZED Order API calls are not showing up in the API logs in the developer dashboard though. Is this intended? I can see 400, 403, and 404 but no 401 statuses.

Also Would it be possible to get some support on why these 401’s are occurring for this customer in this specific situation?

What’s the application ID and the order_id that your getting this with? :slightly_smiling_face:

Hi Bryan,
The application id is sq0idp-oqWVZw2EUpGT9m3LewsSRA and an example order id is OQ1bKkSPppwDhcLfUkupyB9eV.

Everything looks correct from what I can see. Is the access token your using valid and if you call RetrieveTokenStatus with it is the merchant_id: EXGD5W18P4NSV?

Also it is expected that UNAUTHORIZED errors won’t show in the API Logs. :slightly_smiling_face:

Hi Bryan,
Thanks to your comment I believe I have figured out the cause. We reverse look up the user’s id in our system based on the merchant id from the hook. I looked into it and it looks an old copy of the user has the same merchant id so it was just referencing the wrong user on our end I believe. Thanks for the idea! This can probably be closed.

Glad to hear that you were able to figure out the issue. :slightly_smiling_face: