Home » Android » in app purchase – How to check if user paid on android?

in app purchase – How to check if user paid on android?

Posted by: admin May 14, 2020 Leave a comment


I would like to use in-app billing in my android application (instead of creation 2 versions of application – free and pro). If user paid, then additional options in Preferences should be available.
My application synchronizes data with website (not my).
Each time synchronization happens, I would like to check if user paid or not.
How should I do it?

How to&Answers:

I think the easiest means for you would be to use Managed purchase. More on it is at http://developer.android.com/guide/market/billing/billing_admin.html#billing-purchase-type

The “manage by user account” purchase
type is useful if you are selling
items such as game levels or
application features. These items are
not transient and usually need to be
restored whenever a user reinstalls
your application, wipes the data on
their device, or installs your
application on a new device.

Update: website and API updated refer this now https://developer.android.com/google/play/billing/api.html


There are to many ways to do that, i will try and give you some of the most used

  1. what about user accounts? can your application support users? if it does, its practically solved with 1 user per 1 account. just add a flag to your DB for each user. this is the most secure way, its very easy to know if someone is stealing from you thats why all MMO’s (like WOW) use this type of check. you can easily know if theres more then one user on an account as well

the downside is that it requires more processing and some support is case someone’s account gets stolen or other user support of that kind.

  1. you can save a sort of key inside your application. and some other key on the server. if the key matches (either 1 to 1 or after some manipulation) then you have yourself a paid user, other you dont.when someone buys the application then change the key on the device.

  2. just do what you dont want to do and have 2 applications for free and paid it will probably be less work then the other 2 list above.

there are many ways of doing what you want. but i’ll tell you this:
most applications use method 2 but on the opposite direction, meaning serial key.
i dont think your gonna create an mmo so theres no need for option 1 unless you really dont want anyone hacking your application (which i assume no matter what you do it will be hacked in todays world. i’ll advice you to trust those who pay and accept those who dont)

method 3 is just easy in my opinion especialy when you want to just remove menu options, but it also creates duplicate repositories for code.

good luck. what ever you decide is good, make a theft protection, if someone wants to steal it, they will, dont fight it (even PS3 got hacked in the end)