Verify Google Play In-App purchase with server

hello !

I’m trying to make a test in-app purchase (alpha track) using Unity 2019.2.a14.
All is good on technical side - I can see native OS purchase confirmation window and can see purchase details in log.
Now I want to send it to my server using RestAPI to verify.
I found that verification method is:

GET https://www.googleapis.com/androidpublisher/v3/applications/packageName/purchases/products/productId/tokens/token

packageName - is my app bundle - ok
productId - is in-app purchase id - ok
token - ?

I tried to grab it here:

    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {

        string receipt_hash = args.purchasedProduct.receipt;
....

in the received data I found “purchaseToken”, there are many chars like \\ but I hope I copied it correctly.
But when I try to build the GET url and test it using any browser or postman - I see only “not found” as the result.

am I doing something wrong on integration side or should I search on google account settings or elsewhere?

Where are you seeing the documentation for the Google REST call that you are making? I suspect the token is a login/auth token, separate from IAP.

thanks for the answer,
I’m working with a developer’s tutorial found on web, it says next:

Tutorial says that OAuth can work but there is IAM (Identy Access Management) available and its better.
I went to Google Cloud Console, Created a service key in credentials, have a json-file generated, created an account on google developer console (with custom role, be able to read financial/orders data, I was using credentials (email) from this json),
API Access → Google Play Android Developer → Linked (there was also an option to link the game, but I choose “Google Play Android Developer” as I see it from tutorial)

I’ll check again, can’t say I really stuck on something, need to double check and test again and again,
from another side I still curious about the json format that Google say to Unity after purchase done,
there are lot of "" or "\" chars, I guess I can’t parse like that classes, so should I make something like
s = string.Replace(s, "\", string.empty)
s = string.Replace(s, “\”, string.empty)
s = string.Replace(s, "", string.empty)
? : ))

e.g.:

purchaseState\\\":0,\\\"developerPayload\\\":\\\"{\\\\\\\"developerPayload\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"is_free_trial\\\\\\\":false,\\\\\\\"has_introductory_price_trial\\\\\\\":false,\\\\\\\"is_updated\\\\\\\":false,\\\\\\\"accountId\\\\\\\"

p.s.: https://developers.google.com/android-publisher/authorization this looks way too complicated and the token is “temporary” so backend needs to request new access tokens from time to time.