Is there a way to license my products?

Hello, how can I add a licensing system to prevent our products from being shared and used by non-purchasers.

you can do it through purchase code verification systems using envato api:


Hello, yes, I am getting the product information with the code below. But how will I know if this purchase code has been used before.

$verifyURL = '';
        $curlURL = curl_init($verifyURL . '?code=' . $code);
        curl_setopt($curlURL, CURLOPT_HTTPHEADER, self::prepareHeader());
        curl_setopt($curlURL, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curlURL, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curlURL, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($curlURL, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20080311 Firefox/');
        $result = curl_exec($curlURL);
        if ($result != "") {    
            return json_decode($result);  
        } else {
            return false;

You have to make your own database systems where you will store purchase code and domain used that code. then for each new license registration you have to check your DB.