IAB Error You already owned this item

﹥>﹥吖頭↗ 提交于 2019-12-06 03:55:32

问题


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

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

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


回答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.



来源:https://stackoverflow.com/questions/16495510/iab-error-you-already-owned-this-item

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!