"You already own this item" Google play inapp error - android

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 ?

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

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.

Related

Are Refunds For Android In App Consumable Purchases Supported? - In App Billing API V3

I'm not specifically looking to have the option to refund a user for an in app purchase of a consumable, but just in the odd case that a user asks for a refund, either through google, or through the developer of an in app purchase of a consumable.
There does not seem any way of handling refunds through the In App Billing api V3. All documentation points to V2 of the api using broadcast receivers. This does not help me in least bit.
So how are refunds handled in the In App Billing v3 api? I'm assuming for a non consumable, the refund is processed, and then google handles the processing through their backend, and then when a getPurchaseState() is conducted, it would return a value of 2 (refunded). If so, this works great for a NON CONSUMABLE product.
When a getPurchaseState() call to a consumable purchase is made, it returns null. That's assuming if the purchase was previously successful, and that the item was consumed and provisioned. I figure I could store the purchase items locally within the app, but then there is still no way of receiving a refund notification for that product. I can check for purchase state, but again, it will return null, as long as it was consumed and provisioned already.
A slight workaround I can think of right now, is to not consume the purchase on provisioning. So that it remains "unconsumed" according to google, and remains in their database. Now, if a refund is requested, I am assuming a call to getPurchaseState() for that consumable will return refunded, thus the application logic can then subtract/deduct the provisioned consumable from user's inventory. If a user would want to repurchase that consumable again, then before the IAB api call is made for the purchase, get the purchaseState() and/or hasPurchase(), and if there is already a purchase there, consume that item without provisioning, this will let the user repurchase that consumable. Only issue with this workaround, is that if A user wants to re purchase the same consumable product, as soon as the select the option to repurchase, the item must be consumed regardless of whether they successfully repurchase the product or not. So if the user does not complete the purchase, the product is already consumed, and I end up back where I am now with inability to check for refund state on the consumable.
I can't think of any other way to do a refund for a consumable in app product, and that is what I ask here. Is the way I thought of sufficient, or is there a proper way to handle refunds using IAP v3 on consumables?
I was thinking I have 3 options:
Don't offer refunds for consumables, no/little exceptions, but the issue with this is if a user requests refund through google, and not through developer, leading to option 3 below)
Find a workaround (either properly through the api, or with my proposed workaround)
Offer refunds, but have no application logic to subtract/deduct the consumable. In this scenario, users could end up taking advantage of free purchases.
I know this is a super late response to this issue, but it took me quite some time to track down info on this issue, so hopefully it can help someone else out. There are a few ways of doing this... In the Google Play Developer console you can click on the left nav saying "Order Management" which will bring up a list of all recent orders though your app. If you need to refund one you can click on it, or multi select them and refund them in this view. Just a heads up... you will most likely need permissions from your account admin to see this view and refund users.
Your other option is though the API docs here. You will need to set up your API account though the Android console, which I will say is a massive pain and not clear. But once that's set up and your "Server Applications" is set up you will need to make sure it has proper permissions as well. Then you should be able to use a library such as this to do the heavy lifting for you, because from what I've read the JWT auth process though the google API is not super straightforward, and their docs are a mess. I hope this helps someone and comment if you have questions... I will do my best to answer.
This same API also can be used to find items that were purchased by users and then refunded, so you can remove these items from those users' apps. Also you can do server side purchase validation through this as well, which is highly recommended, because rooted phones can inject fake purchase requests making your app believe that it's hearing back from the google play store, but in reality it's not. You then send back to your server the purchase token and SKU of the item being purchased and then on your server you just run this. This will give you back a 400 error if it's invalid, and a 200 with a some JSON data if it's a successful purchase.

What should do for this Scenerio in-app billing

I have an application and I am trying to understand in-app billing. I want to do this : If a user buys an item with in-app billing. user can use this item with same account in different device without paying again. So my scenerio is this:
Assume that I have a application and it has in-app billing V3 service. And then a user purchases an "Managed Product" item and the user has an another device then the user wants to install this purcashed item in other device without paying again. But I read here, people talk about this problem:
BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED
At this point I am thinking to consume this product as soon as it is purchased. with this code:
mHelper.consumeAsync(inventory.getPurchase(SKU_MY_ITEM), mConsumeFinishedListener);
if it right way. what will the user see after clicking buy button in another device.(is it possible free purchase)
Also I am not sure what will happen, if the user uninstall and install again my app. what will user see if click a buy button. (purchase again or free purchase or a ERROR)
Can you give advice about in app-billing service for 1 account and many device and also about what will see a user if try to purchase in another device even everything goes right.
From here http://developer.android.com/google/play/billing/api.html :
Managed In-app Products
Managed in-app products are items that have their ownership
information tracked and managed by Google Play. When a user purchases
a managed in-app item, Google Play stores the purchase information for
each item on a per-user basis. This enables you to later query Google
Play at any time to restore the state of the items a specific user has
purchased. This information is persistent on the Google Play servers
even if the user uninstalls the application or if they change devices.
What you want to do is ( like in the example app ) query the inventory on successful setup of your in app service and consume any managed item thus granting access to it.

In App Purchase You already own this item error

I have two phones with same user account. and subscribed a product from one device. when i trying to subscribe the same in next device it shows error message as "You already own this item" . I need to subscribe the same two devices concurrently. How it can possible ? I am using V3 api for billing. Is there any restriction , that is only one subscription per one account or something like that ? Please help me to solve this issue.
All the purchases you make are synced across all the devices which are logged in with same google account i.e. if you make a purchase on 1 device that purchase will be available with you on all other devices which are configured to same google account and if you try to purchase the same item again IAP takes care of that and won't let you do that.
Still if you want to purchase the an item multiple time(like any healthpack in case of a game) then you need to inform playstore about the consumption of that item even if you haven't consumed it and in that case you need to keep track of that item yourself(use servers to keep track of the items)
check this video: http://www.youtube.com/watch?feature=player_embedded&v=DgcJPIRpfSk

Canceled a order but still shows in my owned item. android inapp purchase

I did implement the v3 api of google play in app purchase in my application.
Everything goes right but the strange thing is when i am testing it using my test account and canceled the order from my merchant account. in my app it still shows the item is owned by test user and he is able to use all premium functions.
Any suggestions on how can i get rid of this.
i tried it using complete uninstall and reinstall.
I believe what you may be seeing is Google Play's device-side cache. If the user reboots his phone it will clear it, otherwise you must wait for Google Play to update it's cache from the Google Servers. I have the opposite problem sometimes... user purchases, but for some reason Google Play gets an invalid response from Google's servers and caches a not purchased result for a couple of days. Rebooting the device, and in severe cases clearing the Google PLay data in the applications list causes Play to resync everything from Google.
If you have bought before by your account and it`s a non-consumable item, when you try again to buy the server will send you a status 'item bought'. (like a restore trasaction)
Else check all fields of the response from server.
Check the responde code:
http://developer.android.com/google/play/billing/billing_reference.html
BILLING_RESPONSE_RESULT_USER_CANCELED 1 User pressed back or canceled a dialog

Problems with Android billing sample app

I followed all of the steps for running the Android billing sample app in http://developer.android.com/google/play/billing/billing_integrate.html#billing-download
I succeeded to buy an item, but there are several issues:
when I select an item to buy, I first get an "Item not found" error, and when I click "ok" I see the product in google play. does this happen to anyone else?
I purchased several new items, I see on my google checkout account that the order is "shipped" BUT in the billing test app, under "Items you own" I don't see anything...
in http://developer.android.com/google/play/billing/billing_integrate.html#billing-download they suggest to
refund purchases that are made with test accounts, otherwise the
purchases will show up as actual payouts to your merchant account
where can I perform the refund? in my google checkout account the "Refund some money" item is greyed out...
Does anyone know how to handle these issues?
They are several reasons
check your products are published or not.
your APK in draf mode or not.
Products must be Activate.
First create TestMails in developer console under Licence key.and your device must have using this mail id as primary mail id of device.

Categories

Resources