nhaarman
nhaarman

Reputation: 100438

Android in-app billing: virtual money

I want to use in-app billing to implement virtual money: a user can for example buy sets of 50, 100 and 250 coins.

I'm wondering how I would manage the number of coins each user has. Do I have to manage that myself or does Android provide something for this? If not, how would I store this information? UID won't work if the user has multiple devices, but I'd prefer not to store email-addresses.

Any thoughts on this matter?

Upvotes: 1

Views: 301

Answers (1)

Raghav Sood
Raghav Sood

Reputation: 82563

What I do is have the data stored on a server and access it through a Web service. I initially stored it locally, but quite a few rooted users started editing the app data and getting extra money.

Essentially, I use in app purchases to have the user pay. When I receive confirmation that the transaction was successful, I send a pre defined string to my server. I don't send raw numeric values like 50 as a user could then make it 500 and get extra cash. Instead, the server matches the string it receives with a list of strings. If there is a match, it adds that much money to the user's account. If there isn't a match, it tells the app there was an error.

Upvotes: 1

Related Questions