In App Purchase in Android: Error response: 7 Item already owned - android

I released beta version of my app to playstore and I have implemented In-App purchases in my app. When I purchase the item for first time it is working fine and try to purchase again it is showing an error response as:
In-app billing error: Unable to buy item, Error response: 7:Item Already Owned.
I created a sample project and published to playstore with In-App purchase implementation. For published app the item purchasing working as expected for multiple times. But in Beta version app I'am unable to purchase an item for the second time. Its not even initiating the process of purchasing.
Why I'am unable to purchase an item for the second time in Beta version app?

because the item is non consumable in the google play console, this means that you can only purchase the item one item and after that you can not. if you want to enable the user to purchase the item more than one time you have to make the item on google play console as "consumable" then you will be able to purchase it as you want.
https://developer.android.com/google/play/billing/api.html
https://developer.android.com/google/play/billing/billing_admin.html

There are two types of products subscriptions and managed products. Managed products can be consumed. You must send a consumption request (consumePurchase call) to Google Play before purchase an item for the second time. Check documentation.

Related

Android In-app purchase: While purchasing got network failed popup but purchase has been completed got an email

I am getting a weird issue from the in-app purchase IInAppBillingService version 3 since 1 week ago.
Below are the steps what I had followed:
Note: I followed these steps because few of my users got same network issue
but purchase has been completed. But app still showing Buy button for
that product. So to replicate the issue I had to follow these steps.
Installed the debuggable signed APK over the play store version.
Clicked on item to buy
Opened the play store popup with Buy button. Clicked on Buy in the purchased popup
I lost the network while purchasing a product. Got a popup with No Internet Connection
Clicked on ok in the No Internet Connection popup. Return to my application.
Again clicked on item to buy.
Now got the Error --> You already owned this item
But the problem is, I didn't get any purchase result in the app mPurchaseFinishedListener callback. I got Null. Even I got the email from the google and I checked that whether it is purchased or not in the Google Play store --> Menu --> Account --> Order History
My product is Managed Product but user can purchased it multiple times. So for that, whenever opening the product or after finishing the purchase consuming the desired purchase based on the skuId if it is purchased.
if (purchase != null && purchase.getItemType().equalsIgnoreCase("inapp"))
{
mHelper.consumeAsync(purchase, mConsumeFinishedListener);
}
Now I am not able consume the product or even not able to purchase. Why is it so that play store completed the purchase but it didn't return the purchase details to callback?
As far as I know if an item already purchased for that SKUID it should return the purchase details. But in my case it is not returning the purchase details.
Can any one help me to resolve this issue?
Do you get an error code of 2 in the response?
It looks like an issue of Google Play services and the Google Play client app getting out of sync because of no network. When the network is available and the sync happens (in a few hours time), you'll be able to buy the product again.

In App Billing, further testing

I got my current app in test with some items to testpurchase. And I´ve done that now but I need to do further testing on those items. Is there a way to simply "restore" those purchases so that I dont get that error "You already own this item" ?
There is a way:
Once an in-app product is purchased, it is considered to be "owned".
In-app products in the "owned" state cannot be purchased from Google
Play. You must send a consumption request for the "owned" in-app
product before Google Play makes it available for purchase again.
Consuming the in-app product reverts it to the "unowned" state, and
discards the previous purchase data.

How we can purchase an already owned item from Google Play?

I am using in-app version 3 in my app. I want to purchase an already owned item from play store. But I saw that managed products can be purchased only once per user account and in Version 3, all in-app products are managed. What should I do?
You need to consume the in-app product within your app by sending a consumePurchase call. Afterwards the item can be purchased again. See https://developer.android.com/google/play/billing/api.html#consume for details.

Google in-app re-buy managed item

Is it possible that I can re-buy a manged item?
I am testing my android app and I did not use the checkPayload method when I bought the item first.
now I implemented the checkPayload method and of course now it tells me that the payload isn't the same... Is it possible I can reject the first time buy and re-buy it again?
I anyway would like to re-buy it again, so I can test my code...
Cancel transaction from google play console, wait a lot of time (few hours) and you will be able to purchase it again.
BTW - you should check inventory on Google Play to get purchased items in case of some issues during purchase (i.e. crash between purchase and notifying the application).
You should be using the latest version of the Google In-App Billing system, in which case you can 'consume' a managed product (all products are managed in v3). Once consumed, the user can purchase the item again. Since this is for testing, you'll want to disable this consumption in your release build.
http://developer.android.com/google/play/billing/billing_integrate.html#Consume

In-App Purchase Purchase Request not display purchase window

I added an Application in Google Play Market. After that i added two products and publish them. After that i purchased some products with my test account. But 2 Days later when i tried to purchase a product. Google play server not gives me any Error and also not shows Purchase window.
As I was created test account which you used to purchase the product. After several purchases the Google play blocks that account for some time for purchases. I faced that problem already, and I did R&D on that. Finaly we implemented a solution i.e create another test account and do purchase using it, as old account get blocked for purchase . After some days you can try with previous account, then it will work fine.

Categories

Resources