5

enter image description here I'm now developing a small game with Google's in-app billing service.

And I reference to Trivial Drive of Google's sample project. Let's me ask you about connection interruption during Purchase Items from Google Play.

It's OK when launching purchase flow with normal internet connection.

I tested like this. As soon as purchase flow is launched, disconnect the internet connection (by unplugging the routers' LAN). After about 2-3 minutes, It shows Connection time out. In merchant account, Money transfer is done. But when I query All owned items, there is no owned item of this ID (purchased recently). And when I try to purchase again this item, It shows "Error You already owned this item".

enter image description here

How can I solve this problem? Anybody encountered like this problem?

Please Help. Appreciate to all comments and helps. Thanks.

AL.
  • 36,815
  • 10
  • 142
  • 281
John Nash
  • 192
  • 2
  • 10
  • 1
    I don't think the Google merchant and Play account will be completely out of sync on Google's side; if this were the case it would be widely known. What _does_ happen, though, is that the [GP IAB V3 Service uses local caching](http://stackoverflow.com/a/14830007/1856738), such that your app needs to be robust in this regard. -- Unfortunately, what you describe is not a problem in itself, so unless you describe the specific issue you have in this regard, the only possible suggestion is to make your app robust with respect to this. – class stacker May 12 '13 at 14:49
  • Sorry for my improper way of Asking question. Thanks for your suggestion. – John Nash May 14 '13 at 04:46
  • Im stuck with the same issue. I had a wifi connectivity issue which resulted in a timeout error, and now a "you already own this item" error. This is now resulting in the app crashing on start. Where can I go to clear the token from my Google account lol? (this seems like it should have a dashboard somewhere bc it happens a lot according to StackOverflow 0.o) – NukeouT Sep 26 '17 at 02:47

1 Answers1

1

The Google IAP flows requires you to call a consumePurchase() API after doing a purchase.

What you need to do is to call the getPurchases() API, this will return a list of purchases along with a purchaseToken. Then you need to iterate through them and call the consumePurchase() API for the purchased, unconsumed products.

For more reference, look at the API reference.

Vinay S Shenoy
  • 4,028
  • 3
  • 31
  • 36
  • Thanks for answering, Vinay S Shenoy. I failed to express that items are not supported to be consumed. They're just games packages for only playing. When I called this method skuList.addAll(inv.getAllOwnedSkus(itemType)); It always returned products ID that I owned. But in above case, it doesn't contain the recently purchasedID. I wondered why Google doesn't return the already purchased ID (Money is transfered) to the owned item list. – John Nash May 11 '13 at 09:34
  • Hmm.. I've not worked with IAP APIs much.. If you call `getPurchases()`, is it returned in the API? – Vinay S Shenoy May 11 '13 at 09:42
  • For the sake of clarification: It's simply not true that Google IAB "requires" you to call `consumePurchase()` after doing a purcahse. First, some items won't be consumed, and second, the question when exactly the cosumption should be signalled depends on the case, despite the description provided by Google. – class stacker May 12 '13 at 14:43
  • @ClassStacker, True, but in this case it seems like the purchases are all consumable products. – Vinay S Shenoy May 12 '13 at 14:50
  • 1
    I finally know why I can't get purchased ID in inv.getAllOwnedSkus(). It take ownedSkus from local cache of Google Play App. I need to clear these caches to get updated ownedIDList. But I don't know how to get updated data from google Play. It may be queryInventoryAsync(). But not sure..... Thanks for all your helps... – John Nash May 13 '13 at 09:38
  • @JohnNash Have you found a solution how to get updated data from google Play? – MB_iOSDeveloper Dec 12 '14 at 09:22