PeterStaev / nativescript-purchase

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

Check if product was already purchased #80

Closed jayhaluska closed 5 years ago

jayhaluska commented 5 years ago

What is the standard way to check whether an item was already purchased? I'm not talking about consumable products.

At the moment I'm saving a variable in the application settings to save the purchased status of my product. But when I uninstall my app and reinstall, the purchased status is lost.

At first I thought, I'll do it with restorePurchases(), but the transactionUpdatedEvent is not triggered. Any idea why?

The only way left is to catch the Exception like in #45. If that is the standard way, then I would suggest adding this to the readme.

PeterStaev commented 5 years ago

Hey @jayhaluska , what you are doing is the correct way to do it. Save the purchased item locally. Then if the user installs the app on another device (or reinstalls is) they must trigger restore purchases and this will trigger the transaction updated event. Not sure why it is not called in your case, but last time I tried it it was called just fine.

PeterStaev commented 5 years ago

No further response so closing this one for now. In case you still have problems, please provide more details.