Search code examples
androidprogressive-web-appstrusted-web-activity

Undefined getDigitalGoodsService in TWA


Trying to integrate DigitalGoodsAPI in PWA app on Playstore. window.getDigitalGoodsService shows as undefined during internal testing of the android app.

So far :

  1. I have signed up for orgin-trials, added the meta tag in PWA page.
  2. Changed the manifest referencing android app,
  3. Enabled play billing in the App, during Bubblewrap
  4. DigitalAssetLinks json is valid
  5. Created an App on Google play and creates its in-App products
  6. Testing via Google play link to internal tester.

window.getDigitalGoodsService still shows as undefined, tried rebuilding multiple times. What am I missing ?


Solution

  • Finally, I was able to solve this. The issue was Digital Goods API, you need to use DigitalGoodsAPI V2 and you must verify the token. Verify the token here : https://googlechrome.github.io/OriginTrials/check-token.html

    in the metatag placement of PWA.

    also make sure, token status appears as success : https://prnt.sc/26he938 <-- this was the major clue that helped me solve the problem.

    Adios.