Javascript Integration

Please note these are examples. It is recommended that you make one that is more complex and adjustable to your needs.

Dependencies

Copy

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

Example JavaScript

Copy

function checkLicense(key, software, version) {
    const secret = 'PUT_YOUR_SECRET_KEY';
    const type = 'license';
    const url = `https://<YOUR_DOMAIN>/api.php?secret=${secret}&type=${type}&key=${key}&product=${software}&version=${version}`;

    fetch(url)
        .then(response => {
            if (!response.ok) {
                throw new Error('Network response was not ok');
            }
            return response.json();
        })
        .then(data => {
            if (data.valid) {
                console.log("Success!");
            } else {
                console.error("Incorrect.");
            }
        })
        .catch(error => {
            console.error('There was a problem with the fetch operation:', error);
        });
}

// Ejemplo de uso
checkLicense('LICENSE_KEY', 'PRODUCT_NAME', 'VERSION_NUMBER');

Last updated