IAP Validation Android

Currently we are implementing IAP Validation through nakama on android and we are hitting problems with service account credentials.
I wouldn’t write if the case is well known, but i have tried using a different service and different language and different framework and verification went smoothly.
So using GitHub - dotpot/InAppPy: Python In-app purchase validator for Apple AppStore and GooglePlay. and a script in it I am able correctly to verify purchase using service account and verification when smoothly but what are differences.

  1. For configuration of python services we had to:
      • Load account_service_json from file and send iit to its validator
    • Define package name
  2. Its validator what it does next is checking validity of the service file and key using oauth2client.service_account module — oauth2client 4.1.2 documentation
  3. Send recepit to validation which then validates based on product_sku and purchase_token and some rest params.

And here in this api validation works smoothly.

Following Nakama in-app guide we did setup everything correctly although i am not 100% sure is key correctly being read as api always fails there, it reports invalid api key file for service.

In console it is shown as:
-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhki
Litterly with newlines through the key.

Now question is: Where could be mistake?
As all different third party services seams to work with service account and client email configured correctly?

Any help is appreciated :slight_smile:

Runtime Info:

  1. Versions: Nakama {3.16.0}, {Docker}
  2. Server Framework Runtime language: Lua
{code or log snippet}

Edit:

  • Seams that problem is with how the backend reads service_account.json and then do the rest of the magic.
  • So currently in backend we tried to do verification with standard usage of function reference
purchase_validate_google(user_id, receipt)

With this api, it already expects that in config we have configured service client email, and service client private key.
Both are entered. While using this api, the backend will return

google api invalid private key.
  1. On 2nd tried, i tried to use already iap_verifiy in Lua, and instead to use client email ,and private key from config, i base64 encoded whole file, then stored in localcache
    Upon calling verifying script i decode base64 and then i convert it to json, and from there i read information about client email, and client private key.
    And this managed to verify purchase.

  2. I went back to

purchase_validate_google(user_id, receipt)

Since it has overloads for client email and client private key, and sent how i was reading it in case 2, and again it faild to do anything and error was api doesn’t exits at all o.O

Please reach out at support@heroiclabs.com

I have sent email regarding this topic.