This has several problems imo. For a starter I have no idea how to do that. It’s not my expertise, I’m sure I could figure it out, but these are things I would like a platform holder to take care off, since they can provide a better, more secure version than me.
There is also the problem that if I would do that, itch wouldn’t get a cut from it, which sounds like a positive but if everyone does that we’ll soon no longer have itch.io and that would be sad :(
Not a real problem, but the last thing is that my suggestion is simply more convenient and easy to understand for devs.
Your example would be very easy to do with it, just upload a version of your game with only 5 levels as the demo, and upload the full version of the game with every level as the paid version. No need to setup a website with payment services myself, make a key generation thingy, etc.