VanDucDev · License System

License API
Documentation

Tích hợp xác thực license key vào ứng dụng của bạn trong vài phút. API đơn giản, không cần xác thực, trả về JSON chuẩn.

Base URL
http://license.ducyuz.com
01 Xác thực

API check key không yêu cầu token hay API key. Chỉ cần gửi license key của người dùng là đủ. Mọi request đều hỗ trợ CORS.

Headers
Content-Type: application/json
Accept:       application/json
02 Cấu trúc Response

Mọi response đều là JSON với các trường sau:

TrườngKiểuMô tả
successbooleantrue nếu key hợp lệ, false nếu không
resultstringMã kết quả chi tiết (xem Result codes)
messagestringMô tả kết quả bằng tiếng Việt
licenseobject|nullThông tin key (chỉ có khi success=true)
Response · success=true
{
  "success": true,
  "result":  "valid",
  "message": "Key hợp lệ",
  "license": {
    "key":       "VanDucDev-ABCD-1234-EFGH-5678",
    "label":     "Khách hàng A",
    "uses_left": 5,          // null = không giới hạn
    "expires_at":"2025-12-31 23:59:59" // null = không hết hạn
  }
}
Response · success=false
{
  "success": false,
  "result":  "expired",
  "message": "Key đã hết hạn",
  "expired_at": "2024-01-01 00:00:00"
}

03 Check Key — POST

Endpoint chính. Gửi key dưới dạng JSON body.

POST /api/check.php

Body gửi lên dưới dạng application/json:

Tham sốKiểuBắt buộcMô tả
key string Required License key cần kiểm tra. VD: VanDucDev-XXXX-XXXX-XXXX-XXXX
Request
POST /api/check.php HTTP/1.1
Host: license.vanducdev.com
Content-Type: application/json

{
  "key": "VanDucDev-ABCD-1234-EFGH-5678"
}
● 200 OK — Key hợp lệ
● 403 Forbidden — Key không hợp lệ / hết hạn / bị ban
● 400 Bad Request — Thiếu tham số key
04 Check Key — GET

Dùng khi cần check nhanh từ browser hoặc query string. Không khuyến khích dùng cho production vì key lộ trong URL.

GET /api/check.php?key=VanDucDev-XXXX-XXXX-XXXX-XXXX
Request
GET /api/check.php?key=VanDucDev-ABCD-1234-EFGH-5678
05 Result Codes

Giá trị của trường result trong mọi response:

valid
Key hợp lệ và đang hoạt động
invalid
Key không tồn tại hoặc chưa kích hoạt
expired
Key đã hết hạn sử dụng
banned
Key đã bị khóa bởi admin
limit_reached
Key đã đạt giới hạn số lần dùng
error
Thiếu tham số hoặc lỗi server
06 Code Examples

JavaScript / Fetch

JavaScript
const checkLicense = async (key) => {
  const res = await fetch('http://license.vanducdev.com/api/check.php', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ key })
  });
  const data = await res.json();

  if (data.success) {
    console.log('✅ Key hợp lệ', data.license);
  } else {
    console.log('❌', data.result, data.message);
  }
};

checkLicense('VanDucDev-ABCD-1234-EFGH-5678');

PHP / cURL

PHP
function checkLicense($key) {
  $ch = curl_init('http://license.vanducdev.com/api/check.php');
  curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => json_encode(['key' => $key]),
    CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 5,
  ]);
  $res = json_decode(curl_exec($ch), true);
  curl_close($ch);
  return $res;
}

$result = checkLicense('VanDucDev-ABCD-1234-EFGH-5678');
if ($result['success']) {
  echo 'Key hợp lệ!';
} else {
  echo 'Lỗi: ' . $result['message'];
}

Python / requests

Python
import requests

def check_license(key):
    res = requests.post(
        'http://license.vanducdev.com/api/check.php',
        json={'key': key},
        timeout=5
    )
    return res.json()

data = check_license('VanDucDev-ABCD-1234-EFGH-5678')
if data['success']:
    print('✅ Key hợp lệ', data['license'])
else:
    print('❌', data['result'], data['message'])
07 Try it live

Test API trực tiếp ngay trên trang này.

🔑 POST /api/check.php