4
votes

I've implemented API version 3 of GooglePlay Inapp purchase.

I'm logged in with the same Google account on two devices.

On device #1, I've just purchased an item using this: https://developer.android.com/google/play/billing/billing_integrate.html#Purchase
When I immediately query the purchased items (on device #1) with: https://developer.android.com/google/play/billing/billing_integrate.html#QueryPurchases it returns the info of the in-app so everything is fine.

When I query the list of purchases on device #2, it won't return the item I've just purchased, it returns an empty list.

When I try to buy the item on device #2 it tells me I already own it.

Any ideas on why the purchase from device #1 is not reflected on device #2 ?

Please note that the inapps are Managed products, so Google should hande the syncing across different devices with the same google account, right ?

2
Yes, it should handle the syncing. How long did you wait before asking here? There's a good chance the data gets cached.David Medenjak
Yeah, it seems an hour has passed and I've started to receive the info on device #2 as well. Well shucks .. it seems that a period needs to pass for the changes to actually take place on google's servers. For device #1, i'm guessing the system uses a local cache for the purchase, until the servers get updated. Could this be it ?AndreiBogdan
Yes. I myself had a problem loading a list of available items this week, usually the solution is just to wait...David Medenjak
The problem is that the app has a video streaming functionality, and If a user buys on one end, the purchase should reflect on the other devices as well ... Oh well, it seems i need to manage the inapp myself or something ....AndreiBogdan

2 Answers

6
votes

It seems that it takes a while for the changed to actually take place on GooglePlay. The device on which I buy the item, seems to cache that I did so, and instead of asking GooglePlay, it takes that from a local cache. That's why another device did not know about the purchase. It took about an hour for the second device to receive the purchase info from GooglePlay.

2
votes

Invalidating a purchase to test it again

This applies to products that the user can buy only once. This means that you don’t consume the purchase. More on consumption later.

In this case, after you make a purchase, if you will try to purchase it again you will receive an error saying that you already own this item.

How do you get past that?

You refund the purchase from Google Play Console. But there’s a catch. When you refund it you will have to remove the entitlement for that product, or the user will still get the error that it already owns the item.

For that, you go into Order Management from Google Play Console main menu and select the Order you just made from your app. (If it’s a test order it will say Test: in front of the product name). Then in order details, you click refund and a screen with some options for a refund like the one below will appear.

enter image description here

In this screen, make sure to check the Remove entitlement box, so the user will no longer own the product in his Google Account. After you click refund you will be able to make a purchase again for the given product.