Google Pay error - google_pay_unauthorized

Hi all. I am trying to get Google Pay working on our app. I have followed the example in the documentation but get the following message returned from the requestGooglePayNonce method:

Error(code=USAGE_ERROR, message=Something went wrong. Please contact the developer of this application and provide them with this error code: google_pay_unauthorized, debugCode=google_pay_unauthorized, debugMessage=This request could not be authorized.)

I have checked me a in ENVIRONMENT_TEST and I am using our staging location id. The only difference between the code in the documentation and mine is in loadPaymentMethod:


We set the total price and the currency code is GBP rather than USD.

Has anyone come across this before?

Cheers, Paul

Hm, if you’re using the sandbox location id this should work. Could you provide your application id and the location id you’re testing with?

Yep, square id is sandbox-sq0idb-RQcNtxM8efz2Rr8Ugx7BPA and location id 6J3V1E5JDPGD2.

Thanks for the info. I just tested in the quick start by putting your sandbox app id in AndroidManifest.xml and the LocationId in the GOOGLE_PAY_MERCHANT_ID within the and was able to successfully generate a nonce with GooglePay. Can you confirm where that you’ve set both these values?

Hey, yep we have the sandbox app id in AndroidManifest . We pass the location id into the createPaymentDataRequest method. If you can generate it on your side must be something we are doing wrong on our end but not sure what?

Hmmm yeah I’m not sure what else it could be. Would you be able to try in the quick start application I mentioned above just to see if that works for you (if you haven’t already)?

Thanks for your help! We ran the quick start application and it worked fine. Went back to our code and we had made an error in this line InAppPaymentsSdk.setSquareApplicationId rather than it picking up the value from the AndroidManifest file we had incorrectly set the value here. Once we removed this line it worked fine. Thanks again for your help and pointing us towards the quick start application.

1 Like