Google InApp Purchases Receipt Verification Python

99 views Asked by At

I am trying to verify Google Play Receipt using API. I have created service account, enabled APIs, successfully got token, but when I send request to API for verification, I get an unknown error, and I am not able to find cause.

My request:

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:

{
  "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"
      }
    ]
  }
0

There are 0 answers