旧货如何消费

How to consume old purchase

我得到了一些消耗品,当我尝试发布时,我忘记了消耗该产品,所以我更新了我的代码,现在我购买但未消耗的产品无法购买。

所以我尝试使用 restorePurchases 获取购买并消费未消费的产品但出现此错误。我该如何解决这个问题?我尝试清除 google 商店中的购买,但我仍然遇到错误。

其他产品工作正常。

this.iap.restorePurchases().then(function (data) {
    console.log("restorePurchases ok");
    let size = data.length;
    for (let i = 0; i < size; i++) {
      this.iap.consume(data[i].productType,data[i].receipt,data[i].signature);
    }
  })
  .catch(function (err) {
      console.log("erreur restorePurchases")
      console.log(err);
     });

(在我的构造函数中)

... public iap: InAppPurchase) ...
TypeError: Cannot read property 'iap' of undefined
at main.js:970
at t.invoke (polyfills.js:3)
at Object.onInvoke (vendor.js:5134)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (vendor.js:5125)
at t.invokeTask (polyfills.js:3)
at r.runTask (polyfills.js:3)

我无法消费从 restorePurchases 到 'convert' 的产品,它们从非消耗品到消耗品

好吧,那是我的错,

我改变这个:

this.iap.restorePurchases().then(函数(数据){ 对此

this.iap.restorePurchases().then(数据)=>{ 现在我可以得到我的插件了...