Reputation: 14581
I am thinking of having a way in my app to offer free unlock codes for valuable users, meaning that they won't have to purchase the app to have full access to it.
Looking into it there are a few ways:
You agree to distribute Promotional Codes only to users located in countries where your Products, in-app item in your Products, or content related thereto, are permitted.
What if I want to reward a user from a country where I don't sell my apps to?
I could generate an unlock code for the user's email... but this rises a bit of privacy issues
I could have the user tell me some code from the app, and then for that code, generate an unlock code... I was thinking of maybe ANDROID_ID. Not sure what security issues may bring the read of ANDROID_ID as for instance the Advertiser id has. Another way could be generating a unique code on app install and use that.
Use something like Firebase Database and then store a bunch of codes there and check if the code entered in the app is available in the server.
I am waiting for your thoughts on how to implement this for android.
Upvotes: 9
Views: 2297
Reputation: 1065
what I can think of is to make a unique id (MD5 hash) for a particular user on your server side and thus having a flag for if the promo code can be applied or not.
If it (flag) changes from false to true, SMS or email the user that he can avail use of some code(sent along, generated by some algorithm on ID and credentials with a validity too) to unlock PAID content in free.
OO-> Else if you want to promote or distribute some of the promo codes like these, create a table with all the sorts of you wanted to distribute, then if any user enters that promo code, simply remove it from the promo code tables and assign that code to that respective user, if not already been used promo code ofcourse.
Upvotes: 0
Reputation: 768
Create a table in a db somewhere, or use something like Firebase with fields [code (String), redeemed (boolean)]
When you want to give a promo code to a user, generate a unique promo code and insert it into the table (code, false).
Have the user enter the code in the app, make a request to your api/Firebase, to redeem that code, which transactionally flips redeemed to true and returns true. Upon receiving true, save something in the app to remember it has been unlocked.
Don't forget to pin the SSL cert for your api to ensure they can't fake the api calls.
or
If you are feeling lazy & don't care about security, just generate a ton of codes, hardcode them in the app, keep a copy, and hand them out to people.
Upvotes: 2
Reputation: 897
I will go with number 3 but with minor variation, Since your plan is to reward users from a country where you don't sell your apps. I would have a reward page that generates randomUUID()
that gets tied to user and my cloud/server by firing a post API directly to my server with header parameters to identify as legitimately my app and legitimate user/account.
That way I can generate UUID on the devices and sync with my rewards on server.
Upvotes: 1