2023-05-20

Invalid Value Error when Verifying Google Pay In-App Purchase on ASP.NET REST API Backend

I am trying to do in app purchase verify for Google Pay on my asp.net rest api backend, but I have problem with that.

Using this endpoint: https://androidpublisher.googleapis.com/androidpublisher/v3/applications/sk.fhrtz/purchases/products/{productId}/tokens/{purchaseToken}

And including token created like that for this request:

var credential = GoogleCredential.FromFile("google_key.json").CreateScoped("https://www.googleapis.com/auth/androidpublisher")
var token = await credential.UnderlyingCredential.GetAccessTokenForRequestAsync();

placeholders in endpoint are correctly changed to actual values, google_key.json file exists and permissions should be setted up correctly.

When I proceed this request, I am getting this error:

{
  "error": {
    "code": 400,
    "message": "Invalid Value",
    "errors": [
      {
        "message": "Invalid Value",
        "domain": "global",
        "reason": "invalid"
      }
    ]
  }
}


No comments:

Post a Comment