mardi 3 septembre 2019

How to consume old purchase

so i got some consumable product, when I try my release, I forgot to consume the product, so I update my code and now the products I bought without consumed it are not buyable.

So I tried to get the purchase with restorePurchases and consume the products not consumed, but got this error. How I can fix this ? I try to clear the purchases in the google store but I still got the error.

The other products works just fine.

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);
     });

( in my constructor )

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

I cannot consume the products from restorePurchases to 'convert' them from non-consumable to consumable

Aucun commentaire:

Enregistrer un commentaire