PeterStaev / nativescript-purchase

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

How to consume the consumable product in Android if consume failed for the first time? #101

Closed lqt93 closed 4 years ago

lqt93 commented 4 years ago

Hi, I have a question related to the consumable product in Android. In my situation, somehow, I could not consume the product for the first time. When I chose to buy the product again, there was an error message: "Product already purchased!". I tried to consume the product many times but it always return response code 5. I do not know how to consume the product to buy it again. Is there any way to solve it?

PeterStaev commented 4 years ago

Hey @lqt93 , checkout #48 for explanation how would you consume such a purchase that was left unconsumed by your logic.

lqt93 commented 4 years ago

@PeterStaev thank you for your quick reply, I will give it a try and let you know the result later.

lqt93 commented 4 years ago

I tried your suggestion and it worked perfectly. To make it clear, in my situation, I saved the transaction's receipt in the database for consuming later in case there is problem, but when I tried to consumed with that saved receipt, it did not work because I did not call restorePurchases() as you mentioned. After calling that restore method, everything worked. Thank you so much @PeterStaev .