I'm developing an android application and I would like some functionality of the application is not free.
I have thought to use in-app Billing Version 3 API, so I have defined an "In-App Product" in the developer console.
After reading the documentation, I know that when I start the purchase flow I should pass in a string token that helps the application to uniquely identify the user who made the purchase.
But how could I obtain a string token that identify the user?
Thanks
you can use developer payload to identify user and for the security.
there are two way to generate developer payload according to your application in app billing requirement.
1) if you are using unmanaged item(not consumable item) then you can use simply UserID which is uniquely identify user in particular your app. you can send developer payload as UserID.
or
you can put email address into developer payload for the unique id if you have user's email id stored into server. when you get response from the google play after user paid for product then fetch it from server database of that user account, match your developer payload.
Local database(Like SQLite):
Either you can pass it on payload as userID
--> it will create problem some time. if you don't want to go with server database then you can simply ignore the develop payload make it as a blank string it will not effect in you code much more.check this link of Nikolay Elenkov answer: stackoverflow.com/questions/14553515/
2) if you are using consumable item(managed item) then you can use random generated string
step 2: set RandomString and SessionIdentifierGenerator class in your activity
step 3: pass payload into your puchase request:
Make note this:
Hope it will help you.
Why do you not create an UUID for each user?