Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

purchased and showitem #109

Open
cyrusonline opened this issue Mar 8, 2016 · 2 comments
Open

purchased and showitem #109

cyrusonline opened this issue Mar 8, 2016 · 2 comments

Comments

@cyrusonline
Copy link

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

@driannaude
Copy link

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. 😸

@cyrusonline
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants