I want to add license to magento2 modules. I am magento2 developer. i want to set license to my modules for free or sell. but don't know how can i add domain license to my modules. Want to set domain license mean that when some one wants to buy or download my module, should give me his domain to activate the module. Anybody can help me?
The is a broad topic and not all your logic for licensing and key validation needs to be written in magento. Especially if you are going to have a licensing domain that validates keys and enables uninterrupted use of your extensions.
Something like this might get you started
However this is just to get you started.
My best advice though is to nag users into getting a key. Display prompts about licence key not being valid on frontend or within admin. Don't start disabling extensions or adding logic which negatively affects functionality.