Open cyrusonline opened 8 years ago
You can use the refreshPurchases() method to force retrieving a list of owned products from the app store. From the documentation:
The plugin retrieve the list of owned products from Google Play during the initialisation and cache the it internally, the getPurchase method returns the local copy of this list. If for some reason you have to force refresh the list of the owned products, use the refreshPurchases method.
inappbilling.refreshPurchases(success, fail);
The parameters are exactly the same, the success callback provides also an array with the owned products.
On success you will be returned an array of owned products. Compare this against your products in your view and apply the appropriate logic to show/change state. :smile_cat:
thanks, I understand your algorithm, but as I am an newbie, could you please teach me(sample code) how to check whether the product is bought by comparing with the return json object of "refreshPurchase". I found a lot in stackflow, but they usually talk about hasownproperty but not the value. For example I want to check whether product id="apple" purchased.
I am new in programming, could somebody show me how to edit the code such that
when somebody purchased , the corresponding item shown (e.g. button or picture)
Thanks