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