Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In-app Billing - Google Play gives me the "You already own this item" message when queryPurchases() returns an empty list

I just made one test purchase for an item, and it failed because my Wi-fi died, but for some reason Google Play then gave me a message that the order was pending or something and that I should check it on some link (I forgot to write it down).

When I tried to make that same test purchase again, Google Play gave me that "You already own this item" error. Said purchase is NOT in my order history in the Google Play dashboard.

What's going on, and how do I resolve this?

EDIT: Clearing the Google Play Store cache, clearing the Google Services Framework cache, and reinstalling the app does not work.


EDIT 2:

I managed to resolve this issue by Force Stopping the Google Play Store app, clearing its data, then restarting it. Right now, I can only conclude that the purchases made when the Wi-fi is disconnected is in the Play Store app's Data, not Cache.

My question thus becomes: Is it the developer's responsibility to handle this particular case (when the solution is not within the app itself), and how does one handle it?

like image 854
Gensoukyou1337 Avatar asked Oct 24 '18 02:10

Gensoukyou1337


People also ask

How do I fix this device does not support Google Play in-app billing?

Go to Android Settings > Applications (also known as Apps & notifications on some devices) > Google Play Store > Storage > tap on Clear storage and Clear cache. Repeat the same steps for Google Services framework. Try buying again. If you still have an error, try step 2.

How does the Google Play billing library store query results?

The Google Play Billing Library stores the query results in a List of SkuDetails objects. You can then call a variety of methods on each SkuDetails object in the list to view relevant information about an in-app product, such as its price or description.

What version of the Play Store do in-app purchases work with?

In-app purchases work best when you are running the latest version of the Play Store. To update the app: On your Android phone or tablet, open the Google Play Store app . Tap Menu Settings Build version or Play Store version. Build version or Play Store version is usually at the bottom of the settings list.

What do I do if my in-app purchase didn't go through?

Check if your item has been delivered. If your payment didn’t go through properly you won’t receive the in-app purchase you tried to buy. Check if it went through using the Play Store app or Google Play on the web: On your Android phone or tablet, open the Google Play Store app . Tap Menu Account. Tap Purchase history to review your orders.

How do I view in-app purchases on Android?

On your Android phone or tablet, open the Google Play Store app . Tap Menu Account. Tap Purchase history to review your orders. On your computer, go to your Google Play account. Scroll down to Purchase history. Look for the in-app purchase. Sometimes restarting the device can help fix in-app purchase issues.


1 Answers

I had the exact same issue, where I got the error message that I already own this item, but the getPurchases call returned an empty list. What ended up working for me was getting the purchase history if this list is empty, and taking the purchase token for the last purchase of this specific product id and using that for the consume:

mService.getPurchaseHistory(version, packageName, "inapp", null, new Bundle());

Keep in mind the history contains the information of the last purchase of each of the product types from this user, so make sure to compare the product id's to the relevant one.

like image 154
gool Avatar answered Nov 09 '22 06:11

gool