PeterStaev / nativescript-purchase

:moneybag: A NativeScript plugin for making in-app purchases!
Apache License 2.0
82 stars 28 forks source link

How to catch the "Already purchased" exception ? #45

Closed RoyiNamir closed 6 years ago

RoyiNamir commented 6 years ago

It seems that the API doesn't provide a way to catch the "already purchased" error
It is thrown at global level.

image

How do you catch it ? I don't know what to show the user .. I need to detect this error

RoyiNamir commented 6 years ago

Got it.

After the promisiying API , I got it in the global catch :

...
catch (e)
  {
   if ((e + "").toLowerCase() .indexOf("already purchased") > -1)
  }