-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better testing/debugging support #33
Comments
Ye I have to say its REALLY painful at the moment, I am struggling even to just get the Using https://github.com/PEConn/beer as an example, it should just work if you serve it locally right? |
Just an idea: would it be helpful if you could get a dummy Digital Goods service object where all the methods returned no data? |
Re: https://github.com/PEConn/beer - no, it needs to be in a TWA context (installed from the Play store) to work with the Play payment method. The CrOS and Android backends rely on the Android bits to complete method calls. The getDigitalGoodsService method should exist on any https site if you have the "Experimental Web Platform Features" flag on or if the site has a valid OT token. |
So this is true ONLY if you are running in a TWA context? So just for my understanding this means to test Digital Goods one must do the following:
Is all the above correct? Then if you want to make another change and test you have to deploy your site to beer.com and reload the CrOS app, theres no way to test it locally, it MUST be published? |
No other context/setup is required for the method to exist. However, to actually get a valid Play DG service object when calling getDigitalGoodsService, you need a TWA context. I'm not sure it has to be a public site or a valid PWA, but it does need to be a TWA in the Play store. |
I have followed the instructions exactly listed here: https://developer.chrome.com/docs/android/trusted-web-activity/receive-payments-play-billing/#on-a-chrome-os-device. I am on the Dev channel of CrOS, I have enabled the flags and STILL no API. I can only conclude that you MUST have the browser running in a TWA context for the API to show.. Edit: I just tried opening the console on |
Yes, https + "Experimental Web Platform Features" flag are the requirements for the method to exist. If you have ideas about how debugging could be more clear in the API itself, please let me know here. |
I have been struggling this for months now. The window.getDigitalGoodsService always appears as undefined. The App is already published on Google playstore with inApp products. [ app.wplms.io ]. |
@MrVibe this API is still in Origin Trial. You can test locally by enabling Chrome flags as mentioned in the chrome dev article or you can sign up for the DGAPI v2 origin trial and add the token on your site. |
Yes using digital goods api v2 , also verified the token here : https://googlechrome.github.io/OriginTrials/check-token.html |
Hi we got this enabled but getting error "unsupported context" running this small snippet : `const PAYMENT_METHOD = "https://play.google.com/billing"; try {
console.log("window doesn't have getDigitalGoodsService."); HOW to detect what might be wrong here ? app published to playstore in beta tester. |
Note for this issue: perhaps we can provide more fine-grained exception messages here? "Unsupported context" means that something is wrong with your app (TWA) context. Either you're not in Android/CrOS (unlikely), or your TWA package isn't installed for the current URL, or you aren't running as an app (in an app window). |
Yes this : or you aren't running as an app (in an app window). |
Hello, I am trying to get this to work but getDigitalGoodsService is undefined even from within a TWA installed from google store internal tests. It doesn't appear in origin trials anymore so I assume this is not necessary. But it just won't work. Was this API deleted? Any research I do leads to stuff from 2022 or older... |
It is still expected to work. You need to be on an HTTPS page on Android or ChromeOS for getDigitalGoodsService to be available. |
You may want to enable
|
A common piece of origin trial feedback is that the API is difficult to test/debug. It requires a deployed instance of the app to really see if things work. Ideally we could make this easier somehow.
The text was updated successfully, but these errors were encountered: