Is it possible to see what is available for purchase with the google in app purchase v3.
I have looked everywhere and I cannot get a hint of how to check if an item you want is available for purchase or not (e.g. I want to have a product in the app at a later time, and I check if I have added it to inapp purchases yet or not, without uploading a new app with those updates or a new database with those updates.
Is this possible, is there a way to query which items are available for purchase?
Not completely.
If you have the SKU code of your product, you can query its details using getSkuDetails(). However, you will need a list of the codes beforehand.
Related
We already have an app on Google Play with in app purchases (as subscriptions), and there are lots of users who already purchased our subscriptions. However, we have developed a new version of this app from scratch and we want to list it on Google Play as a new app. After few months, we want to unpublish the old version of it. There is one issue with this: How do we make sure that users who already purchased subscriptions in the old app keep their subscriptions in the new one? It seems like there is no way around this other than asking them to purchase on the new one. But maybe there is a better idea than that?
P.S. We are publishing as totally new listing because of significant changes in the app and also the old one wasn't taken care of properly, therefore there were many bad ratings. This would be a fresh start.
Maybe , there is a way.
From Your Old App Obtain 2 things
GOOGLE API KEY FOR IN APP PURCHASE
product id (is unique everytime)
Inside the java code, check all the purchase history for this particular product from Billing object.
This library is excellent in simplyfing in-app purchases.
https://github.com/anjlab/android-inapp-billing-v3
I'm pretty sure there is no way to tell the play store that the user has bought a subscription for the new app. You could update the old app to send subscription data to a server which can mark the user as having bought a subscription, and then the server can validate the new app to deliver subscription content. But the play store will not know anything about it.
How can i implement in-app purchases in my application?
I want to disable ads if the user paid me.
I spend a lot of hours to figure how it works by looking for tutorials.
I saw all the lectures on youtube about that.
I read on google developer site:http://developer.android.com/google/play/billing/billing_admin.html
I saw some example codes.
So,
I understood the concept
I know how:
1. create new product.
2. create a test account for testing.
3. publish my application to beta/alpha.
So,my question is:
What should I do in code?How to manage it correctly?
If user paid money for removing the ads how the application know if to show him the ads or not?Do i need to save the data locally manage it with SharedPreference or i getting the status about his purchases automatically? What will happen if the user replace his device?Google remember his account and his purchases?
I really need a basic example :(.
Like few methods that make "buy()" and "isOwned()" for checking if the current user has paid ..
Help me please
First of all implement In-app purchase in your application, you can follow this link.
When user purchased any item successfully, success status will be sent from google.
After purchasing successfully, store some flag value in SharedPreferences, SQLiteDatabase or in your server database through webservices.
Now whenever you are showing ads in your application, check flag value you have stored.
1. if flag shows that user have purchased item, don't show ads.
2. if flag value shows that user did not purchase anything show your ads.
Google remember his account and his purches?
Google will fetch all purchases from user's email id. You can restore purchase from the user, so whenever user uninstalls your app and you dont want user to purchase your item again, give them option of restore. Restore will give their product back and also give you success status.
When my app queries whether it has an in-app product using IabHelper, if there is no connectivity the response I get is:
Error refreshing inventory (querying prices of items). (response: 6:Error)
And that's fine. But when my app tries to purchase an already owned item (still with no connectivity), Google Play returns that the user already has the item in question.
So, since Google Play knows whether a user has an in-app product or not regardless of there being a connection present, how do I get this information without trying to purchase the in-app product? I would like my app to know if it has an in-app product even if there is no connectivity and querying inventory fails, and the only way I know to get this information now is to try to purchase the product.
First. Drop using iabhelper, it is for your own good.
Second. Google Play Services caches information, so sometimes you get responses when device is offline. How and when this happens depends on current services implementation (which can and will change!). Make no assumptions and work with data as returned, offline or not.
I have working app that sells in-app products (InApp billing v3).
Recently I've made an update for this app and made a terrible mistake there: I consumed some of purchases I didn't want to consume.
I issued an update and users updated the app and then wrote me they have no purchased access. (As I found later, I consumed wrong items).
So I have some questions now:
Is there a way to restore consumed purchases or I should return payments to my users?
Is there a way to find out how many and which purchases were consumed?
If returning payments, is there a way to find out if user still has the product or is it consumed with out changing the app (through google services)?
Thanks.
According to what I have understood from your question, It seems like you want to purchase product only once.
What I wished to ask: is there a way to request information about consumed products like about owned products.
you can get response or it's information in any type(Managed Product, Unmanaged Product, Subscription) in the onActivityResult method() check my below link.
In-app billing-v3 error in activity result
but I would not prefer you to manage it customly as you told for one time purchase product(not consumable product). You should go with the Manage product.
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.
for more information about product type
you can query any time you want and you will get the product information, and even you don't need to manage if user has already purchase this product or not.
Is there a way to restore cnsumed purchases or I should return payments to my users?
Better option is you should give the payments back to the user and for the next time check the whole app once using dummy product "android.test.purchased" and update your app.
Is there a wat to find out how many and which purchases were consumed?
You have to check in the Google wallet because all transaction should be handle by the it, check if it gives you product type or not. Using your google developer console credential you can signed into google wallet.
If returning payments is there a way to find out if user stil has the product or is it consumed with out changing the app (through google services)?
as per above answer you have to check in google wallet, according to my knowledge they are provide us all of information about product type with user detail.
Let me know if I have not properly understood your question.
Hope it will solve your problem.
I am building an app that I want to use Google in app billing for. Does Google track in-app purchase history for me, so that I can query history and get data, say, by date or by item, etc. Or must my app itself store user's purchase history on my own backend? Also, if you can please provide a link so I can verify this info.
For your question answer is both YES and NO Google will take care of all purchases based on product type. If you are using Non-consumable or Subscription based products Google will keep records, in other case if you are using Consumable products Google will keep it's record till your app consumes that product.
If your app sends a purchase request Google will associate it with primary gmail account registered on android device and will not allow to purchase same product twice.
NOTE:- If You are using IAB-2 then above product type and flow will slightly different
Non-consumable ** is known as **Managed Products
*Subscription* is same as Subscription
*Consumable* is known as Unmanaged products
In case of IAB-2 google will never keep record of Unmanaged products and it is your responsibility to keep records if you want.
For more details see below link to developer guide.
Developer guide