How to Implement Currency in the Game Using Google In-App Billing Version 3

As in the title, how should I implement a currency system with the latest google billing service in google version.

Basics: I have currency. This currency is either earned or purchased.

The currency is provided to players periodically.

Currency can be bought in lots (1,5,10,20,50,100) or at least that's what I wanted.

Google Play v3 forces you to store data about the owners of supplies on their servers.

You cannot purchase the same item until it is consumed in the first place, removed from the property according to Google, and therefore will not be available in your game.

This presents very hard problems to solve ... if I understand it correctly.

Are you making a ton of "duplicate" shop items to handle the ability of players to make multiple purchases of the same item if they want to top up? Can you make free tracking items?

What if a player buys 100 packages, uses 99. Then deletes and moves to another device? It will return all 100 back. How do you deal with this?

So how do I manage the purchased currency? Can anyone suggest any decent strategies for this?

Thanks, Gullie

+3


source to share


1 answer


By simply using the inApp Billing api, you cannot restore consumables, which seems logical (you cannot restore what does not exist). You can restore an object that has not been consumed due to getPurchases()

. If you want to restore an unbeatable result, you need to handle this part in your application and with a server that will keep track of who buys what and who uses what.

You are not actually restoring the purchase, but the state in which the purchase was changed: if the user buys 100 gold when they move to another phone, they want to get the extra gold back, not the purchase.

After each action, your application should send the user's status to the server (currency amount, level, purchased / used product ...) and return everything back on launch.



Remember that communication between the application and the server must be secure if you want to prevent cheaters.

With inApp v3 you cannot buy another item until the previous one has been used. So if a user buys 100 gold, he used 99. The latter can be restored if he doesn't consume it: http://developer.android.com/google/play/billing/billing_reference.html#getPurchases

+1


source







All Articles