API Integration Guide

Complete guide to integrate the License Manager API with your applications

Base URL

All API endpoints are available at:

https://www.vietnamcos.com/license/api

Authentication

Include your software_id in all API requests:

software_id: "201" // Your unique software ID

API Endpoints

Check License

POST /check-license.php

Validates a license key

Request Body

{
    "license_key": "LIC_123456789",
    "software_id": "201"
}

Success Response (200)

{
    "success": true,
    "data": {
        "valid": true,
        "tier": "professional",
        "expiry_date": "2025-12-31",
        "software_name": "Your Software",
        "auto_renewal": true
    }
}

Activate License

POST /activate-license.php

Activates a license for a specific machine

Request Body

{
    "license_key": "LIC_123456789",
    "software_id": "201",
    "machine_id": "MACHINE_ID",
    "platform": "windows",
    "version": "1.0.0"
}

Deactivate License

POST /deactivate-license.php

Deactivates a license for a specific machine

Request Body

{
    "license_key": "LIC_123456789",
    "activation_id": "ACT_123456789"
}

Code Examples

JavaScript/Node.js

async function checkLicense(licenseKey) {
    const response = await fetch('https://www.vietnamcos.com/license/api/check-license.php', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            license_key: licenseKey,
            software_id: '201'
        })
    });

    return response.json();
}

PHP

function checkLicense($licenseKey) {
    $data = array(
        'license_key' => $licenseKey,
        'software_id' => '201'
    );

    $ch = curl_init('https://www.vietnamcos.com/license/api/check-license.php');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));

    $response = curl_exec($ch);
    curl_close($ch);

    return json_decode($response, true);
}

API Responses

Success Response

{
    "success": true,
    "data": {
        "valid": true,
        "tier": "professional",
        "expiry_date": "2025-12-31",
        "software_name": "Your Software",
        "auto_renewal": true
    }
}

Error Response

{
    "success": false,
    "message": "Invalid license key",
    "code": 403
}

Error Codes

400 - Invalid input data

401 - Unauthorized

403 - Invalid or expired license

404 - License not found

500 - Server error