In App Billing managed and unmanaged state for product - android

I am very new to android.. I am working on In App billing.. My question is what is the main purpose of Managed and Unmanaged state while adding the In App product..
Can any one tell me what is the use of managed state and what is the use of unmanaged state..

The main difference between managed and un-managed is that a managed purchase can only be bought once and is tied to the Google account that purchases it.
Un-managed purchases can be bought multiple times and are intended for consumable items.
For more information, please see the Choosing a Purchase Type section of the Google in-app billing documentation.

As of Version 3 of Google's IAP Billing API this has changed. Both consumable (multiple purchase) and non-consumable items are "managed". Tf you want to use Version 3 of their API, all purchases must be created as "managed". You can then decide if the item should be consumed later.
Here's a link to their docs: http://developer.android.com/google/play/billing/api.html#consumetypes

UnManaged could be something like "Buy 50 points"
The 50 points would then be added to your account and you would store this on your accounts server, therefore the Android Market no longer needs to know that you purchased this product i.e. it will not remember your purchase and you can purchase it multiple times.
Managed could be "Buy this song"
In this scenario you do not have a server to record that they bought the song and so every time they reinstall you can query the market to see they bought the song and it will not let you download it more than once.
Managed is aimed at one time downloads then you 'own that object'.
UnManaged is for multiple downloads of the same thing to 'top something up'.

UnManaged could be something like "Buy 50 points"
The 50 points would then be added to your account and you would store this on your accounts server, therefore the Android Market no longer needs to know that you purchased this product i.e. it will not remember your purchase and you can purchase it multiple times.
Managed could be "Buy this song"
In this scenario you do not have a server to record that they bought the song and so every time they reinstall you can query the market to see they bought the song and it will not let you download it more than once.
Managed is aimed at one time downloads then you 'own that object'.
UnManaged is for multiple downloads of the same thing to 'top something up'.
Least thats my understanding.
Version 3 has the concept of 'consumables' and it works inline with the above. All products are managed but you can 'consume' a product.
i.e. "Buy 50 points" will give the user fifty managed points, the user will not be allowed to purchase that item again until you consume that product.
Therefore you can make unmanaged products by consuming instantly, or managed products by consuming when the user has "used" that product (i.e. never call consume for buying a song).

Related

How to make purchasing one in-app product several times possible?

I'm trying to implement in-app billing system in my app to serve ads free version to users. I learned these steps and finally I succeeded to buy my product by using my test account. (I got the OK resposeCode through onPurchasesUpdated() method.)
However I could not buy it again. There was no response after calling launchBillingFlow(). I don't know why. Even if my product is ads free version (I mean permanent item.), I want to know that buying one item several times. Please let me know.
Once a managed product is purchased, it is considered to be "owned".
Managed products in the "owned" state cannot be purchased from Google
Play. You must send a consumption request for the "owned" managed
product before Google Play makes it available for purchase again.
Consuming the managed product reverts it to the "unowned" state, and
discards the previous purchase data
As soon as the User buys a product from your application, just consume it and keep track of the purchase some other way. By storing the credits on your server may be.
More on the developer site
Just be sure to call mBillingClient.endConnection() before calling mBillingClient.startConnection() again.
If you don't call endConnection() onPurchaseUpdated() will be called for every connection that is not closed.
In my case I call mBillingClient.endConnection() inside onDestroy() method of my activity.

Android In-app product that is not consumable, but several can be purchased

I am having confusion choosing a suitable product type of a commodity in my utility android application.
My application is of a kind where the user is benefitted through the number of 'slots' that they own. Think of it like the length of a ListView. My free application will feature a maximum length of that ListView upto 5. But if a user needs more List Items, they can buy subsequent List Item slots. The user should be able to buy as many as they like at 0.50$ each.
The problem is that, my in-app product neither comes under the definition of a 'managed product' alone, nor does it come under the definition of a 'consumable product' alone. I need the 'slot' product able to be purchased as many times as the user likes. But at same time, i also want Google Play to keep track of the ownership of the amount of slots per user.
As the documentation (and several tutorials out there) suggest:
If i want Google Play to store the purchase information for each item on a per-user basis, i will have to declare my product as a managed (non-consumable) product.
If i want my product able to be purchased many times, i would have to implement consumption for items that can be purchased multiple times.
The predicament is that i want both the features.
One bad solution is that I feature several slot products as unique products (alpha slot, beta slot, ... and so on), and then treat them as the same thing. However, i'd like to know of a solution that's more correct and sensible.
Another solution could be to make use of a separate cloud service to keep track of the number of slots bought by users, but i don't want that. That would be overkill. Also, i'd like to make use of the 'local caching' feature of Google Play Store.
I asked Google Play Developer Support if there were any way that Google Play Store could keep count of consumable in-app products. Turns out, at the moment, it is not possible.
Here is the actual reply (Nov 3, 2016):
I wanted to know whether Play Store also keeps record of the count of a
CONSUMABLE in-app item that a user has bought even after the user
uninstalls and then reinstalls the app?
In short, after user reinstalls, is there any way of knowing as to how many
of a single in-app item has the user ever bought?
Hi,
Thanks for contacting Google Play Developer Support.
I checked into it and the Play Developer Console doesn’t currently
support tracking every individual users every IAP purchase for
developers to see. Luckily, we place a high value on developer
feedback, and I’ll be sure to pass along your specific feedback to our
product team. We’re continually adding new features and functionality,
so please stay tuned.
You can always check the Android Developers Blog for any new features
and updates: http://android-developers.blogspot.com/

Inapp billing which product type to choose for premium upgrade of app for one year

I have a app in which if users selects upgrade your app from menu then i have to do inapp billing to upgrade app and then everything inside app becomes free for one year. And after one year it should come back to normal way.
I have created merchant account and done all setup for implementing Google inapp biling.
Now i wanted to add inapp products but i am not sure which one to select, Managed products or unmanaged products or subscription.
Managed products is aimed at one time downloads then you 'own that object'.
UnManaged products is for multiple downloads of the same thing to 'top something up'.
All subscriptions are auto-renewing, for every app and game and every type of subscription product. After the transaction, Google Play manages recurring billing and keeps users informed of new charges, sending them an email with each renewal. At any time, users can visit My Apps in the Play Store app to view their subscriptions and cancel any subscription as needed.
So in this subscriptions product it does this renewing thing but i wanted is make app free for one year only and after 1 year if user wants to upgrade then he again upgrades through the app.
Which product type should i choose for upgrading app.
You should use managed products. This product will be synced between all devices and preserved by Google Play Services until you consume it. The main point is not to consume the item so it will be available forever once purchased.
Of course you can utilize unmanaged products the same way but it's rather deprecated thing in in-app billing.

How to implement in-game currency with Google's In-app Billing Version 3

Like the title says, how should I implement a currency system with Google's latest in-app billing v3.
The basics:
I have currency.
This currency is earned or purchased.
Currency is given to players periodically.
Currency can be purchased in lots (1,5,10,20,50,100) or atleast that is what I wanted.
Google Play v3 forces you to store ownership details of consumable items on their servers.
You can not purchase the same item over until it is consumed first, removed from ownership according to google, and therefore not possessed in your game any more.
This presents some really painful problems to resolve... if I am understanding this correctly.
Do you make a ton of "duplicate" store items to handle the players ability to make multiple purchases of the same item should he want to restock? Can you make free items that are tracked?
What if the player buys a 100 pack, uses 99. Then uninstalls and moves to another device? He'll get all 100 back. How do you handle that?
So how should I manage purchased currency? Can anyone suggest any decent strategies to handle this?
Thanks,
Gullie
By just using inApp Billing api you can't restore consumable items , which seems logical (you cannot restore something that doesn't exist). You only can restore an item which has not been consumed because of getPurchases(). If you want to be able to restore consummable, you need to handle that part in your app and with a server which gonna track who buy what and who use what.
In fact you're not restoring the purchase but the state that the purchase changed : If an user buy 100 golds , when he move to an other phone , he want to get back the extra gold , not the purchase.
After each action your app should send the user status to the server (currency amount , level, item purchased / used ...) and get everything back on startup.
Be aware that you communication between the app and the server must be secured if you want to prevent cheaters.
With inApp v3 you cannot buy an other item until the previous one has been consumed. So if the user buy 100 gold , he used 99. The last one can be restored if he haven't consumed it : http://developer.android.com/google/play/billing/billing_reference.html#getPurchases

Android In-app Billing network access

I would like to know if the in-app billing api needs to have internet access when checking if the user have purchased an item or not.
I want to sell game levels using the in-app billing but don't want to access the internet everytime the user starts playing the level.
Does market have any cache mechanism to avoid calling the server everytime? Do I need to implement it on my app?
There are two types of purchases. Managed and unmanaged. Managed products can only be bought once, however unmanaged products can be bought any number of times.
There is no caching as such by the market app. Say for example, you have a managed product ID setup, and you a user has already bought it. The next time you request the market app to buy the same item, it will return with a response, saying "already purchased".
In case of unmanaged items, it just carries out the transaction.
In both the cases, internet is required.
It's upto you how you save the transactions locally, and initiate a purchase by checking if you really need to do another purchase.
You don't even need the Internet permission to use in-app billing. Market will take care of that for you.

Categories

Resources