unity 3d how to add serial codes to my game

Hi there, i am making a multiplayer FPS game, and i have multiplayer working, i plan on selling it, os i want it to be protected. I was going to add register and pay on site to login on client. I’m getting confused with that, so i was going to add serial keys once you pay it displays serial key for you to input, and then you make an account on the client. Any help?

is it multiplayer only?

If so generate keys and when they create an account check the typed key against a list of allowed keys.
If it matches allow there username and password to be used to gain full access to the game.

The keys themselves are just random number generated. when they purchase it calls a key generator function that randomly generates a 20 digit number and then displays that number and stores it in the list of allowed keys. when you create an account you type in the key and that key is now linked to that username and password. the key is then marked used so it can’t be reused.