Search code examples
google-chromegoogle-chrome-extensionchrome-web-store

Chrome Web Store (CWS) API Payments TOKEN_MISSING_ERROR


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?


Solution

  • 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.