Tài liệu API

Trang này mô tả các API mua tool, nhập key, sửa key và xoá đơn hàng tích hợp cho hệ thống KeyServer.

Base URL hiện tại: https://servertool.shophuymmo.com/v1/app

Xác thực đang dùng: chỉ cần username
Danh sách 2 Phần mềm trên hệ thống Localhost:
  • 🎬 Bilibili Pro Downloader: b7e41c9a2d6f8035a1c9e72b4f68d013
  • 🚜 FarmReel / Tool MMO: aa92dcf3d3e4894fdd71710e6efffef9

1. Mua tool

POST https://servertool.shophuymmo.com/v1/app/buy-tool.php

Mô tả: Tạo đơn hàng mới trong history_tool. Hỗ trợ mua rent hoặc lifetime, hỗ trợ voucher_code.

Headers

Header Giá trị Bắt buộc
Content-Type application/json Có

Body JSON

{
  "username": "huynguyen2414",
  "tool_code": "b7e41c9a2d6f8035a1c9e72b4f68d013",
  "purchase_type": "lifetime",
  "voucher_code": ""
}

Trường dữ liệu

Trường Kiểu Bắt buộc Mô tả
username string Có Tên user tồn tại trong bảng user
tool_code string Có Mã tool trong bảng list_tool
purchase_type string Có rent hoặc lifetime
voucher_code string Không Mã giảm giá áp dụng cho tool
days number Khi rent Số ngày thuê nếu purchase_type = rent

Response JSON

{
  "success": true,
  "message": "Purchase completed successfully",
  "data": {
    "username": "huynguyen2414",
    "tool_code": "b7e41c9a2d6f8035a1c9e72b4f68d013",
    "tool_title": "Bilibili Pro Downloader",
    "purchase_type": "lifetime",
    "transaction_code": "ABCDEFGH",
    "base_amount": 500000,
    "discount_amount": 0,
    "final_amount": 500000,
    "charged_amount": 0,
    "api_no_charge": 1,
    "expires_at": 2147483647
  }
}

2. Dán mã máy (HWID) & Trả về License Key

POST https://servertool.shophuymmo.com/v1/app/add-key.php

Mô tả: Khách hàng dán mã máy (HWID) của máy tính. Hệ thống sẽ tự động cấp mã License Key, ràng buộc với mã máy này và lưu vào bảng license_keys để phần mềm có thể kích hoạt ngay.

Body JSON

{
  "username": "huynguyen2414",
  "transaction_code": "ABCDEFGH",
  "hwid": "7EF6243DE22BB7D3C3FED0EE0A4BCBD0"
}

Response JSON

{
  "success": true,
  "message": "Đã kích hoạt bản quyền thành công cho mã máy của bạn!",
  "data": {
    "username": "huynguyen2414",
    "transaction_code": "ABCDEFGH",
    "hwid": "7EF6243DE22BB7D3C3FED0EE0A4BCBD0",
    "license_key": "933M-15OW-X9IK-FQSS-QRG9",
    "key": "933M-15OW-X9IK-FQSS-QRG9",
    "tool_code": "b7e41c9a2d6f8035a1c9e72b4f68d013",
    "tool_title": "Bilibili Pro Downloader",
    "expires_at": 2147483647,
    "expires_at_iso": "2038-01-19T10:14:07+07:00",
    "next_change_at": 1760000000,
    "next_change_at_iso": "2026-10-19T13:48:19+07:00"
  }
}

3. Đổi mã máy (Cấp License Key mới)

POST https://servertool.shophuymmo.com/v1/app/update-key.php

Mô tả: Khi chuyển sang máy tính mới, dán mã máy mới (HWID) để hệ thống thu hồi key cũ và cấp mã License Key mới tương ứng.

Body JSON

{
  "username": "huynguyen2414",
  "transaction_code": "ABCDEFGH",
  "hwid": "NEW-HWID-456789"
}

Response JSON

{
  "success": true,
  "message": "Đổi mã máy và cấp License Key mới thành công!",
  "data": {
    "username": "huynguyen2414",
    "transaction_code": "ABCDEFGH",
    "hwid": "NEW-HWID-456789",
    "license_key": "ABCD-1234-EFGH-5678-IJKL",
    "key": "ABCD-1234-EFGH-5678-IJKL",
    "tool_code": "b7e41c9a2d6f8035a1c9e72b4f68d013",
    "tool_title": "Bilibili Pro Downloader",
    "expires_at": 2147483647,
    "next_change_at": 1760000000
  }
}

4. Xoá đơn hàng

POST https://servertool.shophuymmo.com/v1/app/delete-key.php

Mô tả: Xoá hẳn đơn hàng trong bảng history_tool và huỷ key liên quan trong license_keys.

Body JSON

{
  "username": "huynguyen2414",
  "transaction_code": "ABCDEFGH"
}

Response JSON

{
  "success": true,
  "message": "Order deleted successfully",
  "data": {
    "username": "huynguyen2414",
    "transaction_code": "ABCDEFGH"
  }
}

5. Quy tắc tính phí API

Cột trong bảng users: api_no_charge

Nếu api_no_charge = 0: mua hàng bằng API sẽ bị trừ tiền vào total_money.

Nếu api_no_charge = 1: mua hàng bằng API sẽ không bị trừ tiền.

SQL cập nhật user không bị trừ tiền

UPDATE `users`
SET `api_no_charge` = 1
WHERE `username` = 'huynguyen2414';

6. File test API

Bạn có thể test toàn bộ chức năng tại file:

https://servertool.shophuymmo.com/api-test.php