验证Google Store应用内购买需要什么权限? [英] What permissions are required for validating Google Store In-App Purchases?

查看:168
本文介绍了验证Google Store应用内购买需要什么权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用从客户端(内部发行版)收到的令牌来验证用户购买. 为此,我将Python脚本与Google Python API客户端( https://github.com /googleapis/google-api-python-client ).

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."

正在使用的服务用户在Google Play控制台中为帐户授予管理员权限(出于测试目的),并在"Google Cloud Console"控制台中将其设置为项目所有者"(出于测试目的)再次).

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).

这里似乎有什么问题?

推荐答案

所有者"权限足以接收验证

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

您遇到的错误很可能是传播问题,实际上服务凭证在整个系统中生效大约需要24小时.

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.

这篇关于验证Google Store应用内购买需要什么权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆