Ionic in app purchase error {"__zone_symbol_currentTask": {"type":"microTask", "state":"notScheduled", "source":"Promise.then", "zone":"angular","cancelFn":null,"runCount"0}}

hi,

i tray using in app purchase
after buy product i get this error

 {"__zone_symbol_currentTask": {"type":"microTask", "state":"notScheduled", "source":"Promise.then", "zone":"angular","cancelFn":null,"runCount"0}}

any help please

You should use like below


var iap=this.iap;
    iap
    .getProducts(['com..buying'])
    .then(function (products) {
      alert("then")
      alert(JSON.stringify(products));
      iap.buy('com.buying')
      .then((data)=> {
        alert("buy success")
          alert(JSON.stringify(data));
          alert(data.transactionId)
          alert(data.receipt)
          alert(data.signature)
        })
       
    })
    .catch(function (err) {
      alert('error')
      alert(JSON.stringify(err, Object.getOwnPropertyNames(err)));
    });

Instead of all this variable assignment and nested promise nonsense you should just do:

this.iap
    .getProducts(['com..buying'])
    .then(products => {
      alert("then")
      alert(JSON.stringify(products));
      return this.iap.buy('com.buying');
    })
    .then((data)=> {
        alert("buy success")
        alert(JSON.stringify(data));
        alert(data.transactionId)
        alert(data.receipt)
        alert(data.signature)
     })
    .catch(err => {
      alert('error')
      alert(JSON.stringify(err, Object.getOwnPropertyNames(err)));
    });
2 Likes

I am also having the same error, it occurs in simple async call which returns a promise.
Did you find any resolutions? please let reply on thread if you have found the solution.

Thanks :slight_smile:

Did you found a solution? I have the same problem :confused: