Chrome 网上商店 (CWS) API 付款 TOKEN_MISSING_ERROR

Chrome Web Store (CWS) API Payments TOKEN_MISSING_ERROR

问题: 我无法在 Chrome Web Store (CWS) API 查询我的扩展产品,我收到此错误: "TOKEN_MISSING_ERROR"

我正在尝试在不使用服务器的情况下设置付款:

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

如果有兴趣,这些是我一直在参考的主要 docs

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"
    ]
  }
}

在background.js中:

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

控制台响应: response: {errorType: "TOKEN_MISSING_ERROR"}

我做过的事情:

有没有人在没有服务器的情况下像这样工作的 Chrome 网上商店付款?我的配置与您的相匹配吗?我的故障排除步骤是否准确?您可以尝试哪些不同的方法?

应该是你缺少identity权限

对此,官方文档有详细说明:https://developer.chrome.com/webstore/one_time_payments#update-manifest

你可以试试,如果有问题请告诉我。