Mint dynamic tokens to players

I am trying to develop a game and I have a problem which is the following point.

In my game players will accumulate my token off-chain (ERC20), at some point they will have the option on my website to "redeem" these tokens and thus will have the value in their wallet.

My problem is in this process.

How can I securely enable token coining dynamically for my player accounts?

I've been reading several tutorials recently but I can't find any example code for this situation.