transactions – Payment Gateways using BTC best practice

I am trying to understand the common practice when it comes to using BTC as a way of transaction on websites. Let us consider gaming/gambling websites that operate using BTC, namely, the user sends BTC to a wallet and in return, he tops up his account to play and he can finally withraw the money. I wonder about the backend of this process, is there any matching engine involved that assigns a unique ID to each user and hence their specific transactions?

Many websites are using this method (yet I won’t mention them not to advertise), so I can assume there might be some ready-to-use solutions out there?

My own problem boils down to a very similar situation, suppose there is a website, I want users to be able to top up their account using external wallets and in return I would give then e-tokens (exclusive to my website), finally, they can exchange the e-token back to BTC and withdraw as they wish.