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:
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 ConfigHelper.java 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.