I'm trying to find the best solution to integrate Ethereum-based payments into web application and I'm looking for advice from someone who already faced this task.
My case:
Online-gambling solution where users can deposit money on their account and make bets.
Requirements: Payments should be Ethereum-based i.e. users transfer ETHs and get some game money (tokens) or see their balance directly in ETHs.
Solutions I'm seeing and their issues:
1) User transfers ETH to the address of app owner and gets tokens(we add tokens to user in app database). This looks to me as not good solution because it's not easy to identify what user made the money transfer. To do this we should store user's addresses in app database and analyze transactions of address of app owner.
2) Create something similar to Token contract. In this case user will be able to transfer ETHs to some address and get tokens (stored in the blockchain).
Issue: identify the user - is again an not so easy (the same issue as described above).
I know it's possible to use MetaMask, in this case user identification isn't necessary, but in this case game logic must be placed in smart-contract. Using MetaMask and fully decentralized app aren't acceptable, it will be too expensive. Firstly, because the games are very dynamical with a lot of state changes (game in progress, money in game, etc), a lot of gas will be required.
Secondly, actions depends on state, so state changes must be available momentarily, it's not acceptable to wait while transaction will be mined.
3) Create new ethereum address for each registered user(save private keys in database). In this case some sync logic on app backend (ETH to internal currency[tokens in app database]) will be required.
For example, user transfers ETHs to created address then goes in app and clicks 'Sync' button, then app checks amount of ETHs on created for user address, transfers this ETHs to the address of app owner and adds tokens(internal currency) for this user in app database.
4) Create smart-contract for which users will be able to transfer ETHs with additional data(some unique identifier). In this case some complicated sync logic is required too.
Example: when user wants to get tokens(internal currency), app provides him contract address and generated unique identifier and saves this identifier in app database(one-to-many user/identifiers). User transfers ETHs to provided contract address and adds additional data(generated unique identifier), contract saves how much ETHs was transferred using this unique identifier, app backend uses this information to add tokens(internal currency) in app database[call of functions that doesn't change state are free].
As for me options 3 and 4 looks more acceptable, but I'm not sure my thoughts are correct, because I'm newest in blockchain development. Maybe there are better and more correct solutions.
a) Am I correctly understand described flows?
b) Are there any better or more correct solutions for my case?
c) What solution should I choose?