How to achieve charging function in ghpy file?

Maybe it’s too complicated to talk about specific code, just the general method is enough.
I have some ideas but I’m not sure this can work:

Write a register system and store user’s machine code and account in net sever if they paid. Check the account in the net sever every time they open this GH plugin.

or is there any better or convenient method?