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

Purchases are not "owned" after app restart [Android] #295

Closed
viktorstaikov opened this issue Sep 25, 2015 · 2 comments
Closed

Purchases are not "owned" after app restart [Android] #295

viktorstaikov opened this issue Sep 25, 2015 · 2 comments

Comments

@viktorstaikov
Copy link

Hi guys,

My case is like this: I have an app that offers subscriptions for extra functionality. The problem is that after a subscription is purchased (successfully), the app works as expected, but when the app is closed and started again - it looks like nothing was purchased and when I try to buy it again, I get "You have already bought this item." from Google Play. As I check my Google Play account I can see the active subscription.

I'm using Cordova 4.0 and latest version of the plugin.

After some debuging it turned out that the state of the subscription is approved and not owned, as expected. owned property is false. transaction property is populated with the coresponding data. canPurchase is false.

So... What can be causing this anomaly or where can I look for the "troublemaker"?

@j3k0
Copy link
Owner

j3k0 commented Sep 26, 2015

Hey viktor,

Your code is responsible for having the purchase go from "approved" to "owned". This allows your app to perform validation of the purchase each time it starts.

You should have something like:

store.when("my_product").approved(function(p) {
    // no validation, just confirm the purchase.
    p.finish();
});

This will be called each time your app starts for all purchases, allowing you to check if they're expired, fake or whatever (if you want to do those checks).

-JC

@viktorstaikov
Copy link
Author

Thanks,

I have reviewed my code and adjust it to your comment and now it is okay.

Thanks 😃

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