Unexpected error when querying Google Play Developer API

256 views Asked by At

We have been trying to set up the sample app for Play Billing workflow with subscriptions as we are looking to introduce subscriptions in our app. We wanted to have the ClassyTaxi app running end to end in order to understand the flows better. Although for past 2 days, we are only trying to debug issues and/or missteps because of some really poor documentation on Google's front.

After ensuring every single step was correctly followed, we were able to make some progress and have the app working with the correct Skus as configured in Play Console. But now the backend server (ClassyTaxiServer) is throwing below error:

"Unexpected error when querying Google Play Developer API. Please check if you use a correct service account" - "OtherError: The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.".

We have relooked, recreated the service account on the Cloud Console several times, but no luck. The Play Console is correctly linked with the Google Cloud project and the access is correctly granted to the service account.

Anyone has any suggestions? How can a sample app be so difficult to set up and function as expected? Or are we doing something terribly stupid?

Please help.

Thanks.

1

There are 1 answers

0
iouhammi On

I passed trough similar situation, and I get same issue. After checking I found a note in google documentation saying the following:

Note: As of December 1, 2019, the Google Play Developer API is available only for version 3 and higher. If you're using a lower version of the API, you must migrate to version 3 by this date. For more information on migrating to version 3, see Changes to the Google Play Developer API.

Investigating the implemented code I found that the sample uses v2 of the google API (check ./subscriptions/play-billing/PlayBilling.ts line 70). So to avoid this situation, you will need to set it to v3, and update googleapis dependency to latest version in package.json.

Additional Notes

After solving this issue, I had a different message in 'OtherError', this time is “The current user has insufficient permissions to perform the requested operation.”. I will note my solution here just someone passed through similar situation:

  • In google play console, and after clicking on 'Grant access' in 'API Access' tab, you will need to select the user and add some permissions to the user (in my case I set it to admin, but I think it's larger than needed), make sure also to add the app/apps you are listening to.
  • If the issue is still running, just edit any of your products or just try creating new one, this step will clear the google cash and refresh permissions. (Check this question).