Google Developer API for in app subscription receipt check(insufficient permissions issue)

Viewed 744

I want to use Purchases.subscriptions:get. in my django server

My Google API's project is linked my android application.

And i used service account(json) of Google API, service account's permission is project's owner and google play console's admin.

This is my code

from oauth2client.service_account import ServiceAccountCredentials
from httplib2 import Http
from googleapiclient.discovery import build

scopes = ['https://www.googleapis.com/auth/androidpublisher']

credentials = ServiceAccountCredentials.from_json_keyfile_name('service_account.json', scopes)

http_auth = credentials.authorize(Http())

androidpublisher = build('androidpublisher', 'v3', http=http_auth)
product = androidpublisher.purchases().products().get(productId="", packageName="", token="")

purchase = product.execute()

This is response.

The current user has insufficient permissions to perform the requested operation

What's wrong????

1 Answers

Possibility 1

Possibly your service account doesn't have the required permissions? This is what the error message says.

In the Play Console, click on

  • Settings
  • Users and Permissions

Look for your service account. Check that it has all the needed permissions to get Purchase information (probably needs read financial data permission)

Possibility 2

You seem to be passing an empty package name, productId, and token in, Have you tried setting these correctly?

Related