service.acknowledge 未定义使用数字商品 API 和 Google 在 TWA 中播放

service.acknowledge is undefined using Digital Goods API with Google Play in TWA

我有一个正在开发的网络应用程序,我正试图在 Android 和 Chrome OS 上添加 Google Play Billing。我的实现与 Google's own documentation 基本相同,但是它在完成后确认购买时失败,抛出 TypeError: service.acknowledge is not a function。其他一切正常,但无法确认购买意味着 Google Play 会在一段时间后自动撤消它。

显然那是因为他们改变了 API 而只是 have not yet updated that page of documentation。显然 service.acknowledge 已被删除,他们现在需要将购买令牌传递给您自己的 back-end,然后让 that 调用 Google Play Developer API 确认购买。

不幸的是,这似乎不太可能改变,因此像 Cordova 这样的选项目前仍然是 client-only 购买 in-app 网络应用程序的最佳选择。