1

Problem: I can't query Chrome Web Store (CWS) API for my extensions products, I get this error: "TOKEN_MISSING_ERROR"

I am trying to set up payments without using a server:

"The Chrome Web Store (CWS) API can be used to handle in-app purchases without the use of any server-side coding as was previously required by the deprecated Google Wallets for Digital Goods API."

For the interested, these are the main docs I've been referencing.

manifest.json

{
  "manifest_version": 2,
  "name": "HTTP Sherifff",
  "description": "URL Whitelisting Script",
  "version": "0.7",
  "permissions": ["storage", "activeTab", "webRequest", "webRequestBlocking", "webNavigation", "https://www.googleapis.com/"],
  "icons": { "16": "sheriff_boot.png",
             "48": "sheriff_boot.png",
            "128": "sheriff_boot.png" },
  "background": {
    "scripts": ["background.js", "buy.js"]
  },
  "browser_action": {
   "default_popup": "popup.html"
 },
 "oauth2": {
    "client_id": "493953193377-ldt1t6b4d2p86gv99je684jni6ck7tsj.apps.googleusercontent.com",
    "scopes": [
        "https://www.googleapis.com/auth/chromewebstore.readonly"
    ]
  }
}

In background.js:

console.log('buy', google.payments.inapp.getSkuDetails({
'parameters': {'env': 'prod'},
'success': onSkuDetails,
'failure': onSkuDetailsFail
}));

Console response: response: {errorType: "TOKEN_MISSING_ERROR"}

Things I did:

  • Ensured valid sessions for the same google account in my chrome dev dashboard, google api console, merchant account, and my current chrome session (then switched chrome session to trusted tester in another attempt). Chrome Packaged App TOKEN_MISSING_ERROR

  • Created trusted tester account with different email and published the app to trusted testers

  • Added an in-app product and set it to active
  • Added oAuth config
  • Published to prod and tested

Has anyone gotten Chrome Web Store Payments working like this without a server? Does my config match yours and do my troubleshooting steps seem accurate? What might you try differently?

Jbur43
  • 1,284
  • 17
  • 38
  • 1
    I've just tried creating an test in-app purchase in my extension and it worked. The only difference I find with my extension is that I have `identity` as one of the `permissions` in the manifest. Not sure if that would affect anything, though... – Iván Nokonoko Feb 26 '19 at 20:56

1 Answers1

2

Should be that you are missing identity permission

In this regard, the official documentation has a detailed description: https://developer.chrome.com/webstore/one_time_payments#update-manifest

You can try it, if there is a problem, please let me know.

Black-Hole
  • 893
  • 8
  • 20
  • There is a internal 500 error when I use the one time payments tutorial/example. Yes I have correctly set the client id in Google Console platform as well as the manifest.json is correct. – Staafsak Mar 03 '19 at 15:29