Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IAB Error You already owned this item

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.

like image 635
John Nash Avatar asked Nov 13 '22 05:11

John Nash


1 Answers

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.

like image 92
Vinay S Shenoy Avatar answered Nov 14 '22 23:11

Vinay S Shenoy