Intermittent Not-Authorized 401 error on creating Payments

We’ve been receiving an intermittent not-authorized error when creating payments.
The error would go away when we retry in 1 minutes (as can been seen in the req/resp attached below)

Any suggestions why we are getting this errors or how we can fix that?

Screen Shot 2020-08-19 at 10.46.31 AM

Screen Shot 2020-08-19 at 10.46.02 AM

I found the error for that location (9JDDYZQ61HE7Y). The access token that was being used was for another merchant account that doesn’t have access to this location. I do see the order was successfully created for this location (9JDDYZQ61HE7Y), so I’m not sure how it got changed, but the CreatePayment request was definitely for a different merchant account.

Hi Stephen,

Interesting. Because the only thing we did was retry the same request.
Are you seeing two different bearer tokens for the two requests?

I guess the LogViewer would be very handy to address this issue.

We do not log the actual access token for security reasons, but I can see the merchant that is tied to the request, and the CreatePayment request was for a different merchant (it doesn’t have that location), which implies it is a different access token.

Does your application do many requests/functions in parallel? I’m wondering if even though it was a retry, is there any possibility of the access token (merchant) being swapped before the retry (ie is there another part of your code that runs at the same time that can change tokens)?

We process many requests at the same time. Our team is now investigating a potential race condition or anything else like that which could have caused this.

Thanks Stephen.

1 Like