3

We were trying to validate the receipt generated from the mobile app from the server-side. It was working initially, but we were providing the receipt details directly to the code. Now we are trying it from the mobile app API functions, we are getting an error code 503.

{
  "error": {
    "code": 503,
    "message": "An internal error occurred.",
    "errors": [
      {
        "message": "An internal error occurred.",
        "domain": "androidpublisher",
        "reason": "subscriptionInternal"
      }
    ]
  }
}

What I am doing is validating my receipt by using google API. For that, I have created a service account in google play console and grant permission for the same. And also created OAuth 2.0 Client IDs in the developer console.

By using the client_id, client secret and redirect URI am validating the receipt.

If I am giving an invalid data in the Google API, for example, I enter the package name incorrectly then it will show a correct response like

{
  "error": {
    "code": 400,
    "message": "The purchase token does not match the package name.",
    "errors": [
      {
        "message": "The purchase token does not match the package name.",
        "domain": "androidpublisher",
        "reason": "purchaseTokenDoesNotMatchPackageName",
        "location": "token",
        "locationType": "parameter"
      }
    ]
  }
}

The issue is happening when I give all the data correctly in my code.

And I already did the same in another project and I get a correct response also. But I have no idea why here the response is always 503.

below one is sample URL which I am using to make receipt validation in server-side

'https://www.googleapis.com/androidpublisher/v3/applications/appId/purchases/subscriptions/subscriptionId/tokens/myPrchaseToken?access_token=myAccesstoken'

  • 1
    We ran into the exact same issue in April, and have so far been totally unable to fix it. We've opened multiple support requests with Google, and they have been unable to resolve the problem. We found that we were able to perform other requests on the tokens, though (like acknowledging, refunding, etc). Honestly, this has been a nightmare for our team. Good luck! I hope you have better luck than we have had. – SlimeBaron Jul 13 '20 at 21:48
  • Same situation here. Did you end up finding a fix? – jeko May 30 '22 at 08:26
  • Please post your any answer that might help other user. – Ayush Sth Jun 01 '22 at 15:31

1 Answers1

0

We have also been having this same issue. Google support is quiet, so not helpful at all. What we've done to fix the situation temporarily is to call v1 of the API when v2 repeatedly fails with a 503 error.

So, we first try the endpoint described in https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptionsv2/get

For some purchase tokens this just returns 503, so then we call the v1 endpoint described in https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get

Note that the v1 response is different from the v2 response, but you can get most information from there, except the product id. So you need to make sure that your app provides this product id to your backend.

We have not seen any instances where both the v1 and v2 endpoints returned the error.

Ilja Booij
  • 1
  • 1
  • 1