What permissions are required for validating Google Store In-App Purchases?

余生颓废 提交于 2020-01-02 08:19:10

问题


I am trying to validate user purchase with the token received from the client (internal release). For that I am using Python script with Google Python API Client (https://github.com/googleapis/google-api-python-client).

    import httplib2
    from oauth2client.service_account import ServiceAccountCredentials

    token = "token received from the client"

    http = httplib2.Http(timeout=self.http_timeout)

    credentials = ServiceAccountCredentials.from_json_keyfile_name(
        "./service_account.json", "https://www.googleapis.com/auth/androidpublisher"
    )
    http = credentials.authorize(http)

    result = build("androidpublisher", "v3", http=http)\
            .purchases()\
            .products()\
            .get(packageName="<package name>", productId="<subscription id>", token=token)\
            .execute(http=http)

The response I am getting from this call is:

HttpError 401 when requesting https://www.googleapis.com/androidpublisher/v3/applications/<package name>/purchases/products/<subscription id>/tokens/<token>?alt=json returned "The current user has insufficient permissions to perform the requested operation."

The service user being used is give admin permissions to the account (for the sake of the test) in Google Play Console, and set to be "Project Owner" in "Google Cloud Console" console (for the sake of the test again).

What seems to be wrong here?


回答1:


The 'Owner' permissions are sufficient to receipt validation [Source].

The error you're getting is most likely a propagation issue where it can actually take ~24hrs for the service credentials to go into effect throughout the system.



来源:https://stackoverflow.com/questions/56952212/what-permissions-are-required-for-validating-google-store-in-app-purchases

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!