Google InApp 购买收据验证 Python

问题描述 投票:0回答:1

我正在尝试使用 API 验证 Google Play 收据。我已经创建了服务帐户,启用了API,成功获取了令牌,但是当我向API发送请求进行验证时,出现未知错误,并且无法找到原因。

我的要求:

package_name = '...'
product_id = '...'
purchase_token = '...'

url = f"https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{package_name}/purchases/products/{product_id}/tokens/{purchase_token}"
response = requests.get(url, headers={'Authorization': f'Bearer {credentials.token}', 'Accept': 'application/json'})

错误:

{
  "error": {
    "code": 404,
    "message": "The document type is not supported.",
    "errors": [
      {
        "message": "The document type is not supported.",
        "domain": "androidpublisher",
        "reason": "unsupportedDocType",
        "location": "token",
        "locationType": "parameter"
      }
    ]
  }
python android androidpublisher
1个回答
0
投票

我也遇到这个问题;问题是使用了错误的接口。 尝试:https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}

方法:购买.产品.get 方法:purchasing.subscriptions.get

解决思路来自于下面的问题。 Android:应用内购买收据验证 google play

© www.soinside.com 2019 - 2024. All rights reserved.