Tài liệu API đại lý
API cho phép đối tác kết nối website của mình với vSon Store để tra cứu sản phẩm và mua tài khoản tự động, trừ vào số dư ví trả trước.
1. Xác thực
Mọi request phải kèm API key (do quản trị viên cấp) trong header. Key có dạng vsk_live_…
Authorization: Bearer vsk_live_xxxxxxxxxxxxxxxxGiữ key bí mật tuyệt đối. Nếu lộ, báo quản trị viên thu hồi & cấp lại. Base URL: https://muanhieuhoannhieu.io.vn
2. Danh sách endpoint
/api/v1/productsDanh sách sản phẩm + giá đại lý + tồn kho/api/v1/balanceSố dư ví hiện tại/api/v1/ordersĐặt mua — giao tài khoản tự động/api/v1/orders/:codeTra cứu 1 đơn (kèm tài khoản đã giao)3. Lấy danh sách sản phẩm
curl "https://muanhieuhoannhieu.io.vn/api/v1/products" \
-H "Authorization: Bearer vsk_live_xxx"Phản hồi:
{
"ok": true,
"data": {
"discountPercent": 10,
"products": [
{
"id": "clxxx...",
"slug": "shopee-affiliate",
"name": "ACC Shopee Affiliate",
"retailPrice": 100000,
"agentPrice": 90000,
"warranty": "Đăng nhập thành công",
"inStock": 42
}
]
}
}agentPrice là giá bạn thực trả (đã trừ chiết khấu). inStock là số acc còn trong kho.
4. Đặt mua
Gửi productId (hoặc slug) và số lượng:
curl -X POST "https://muanhieuhoannhieu.io.vn/api/v1/orders" \
-H "Authorization: Bearer vsk_live_xxx" \
-H "Content-Type: application/json" \
-d '{ "slug": "shopee-affiliate", "quantity": 2 }'Phản hồi (201) — tài khoản giao ngay trong credential; nếu tài khoản có kèm file JSON, nội dung nằm ở json (null nếu không có):
{
"ok": true,
"data": {
"code": "DH-A1B2C3",
"status": "COMPLETED",
"total": 180000,
"items": [
{ "product": "ACC Shopee Affiliate", "unitPrice": 90000, "credential": "user1@mail.com|matkhau|...", "json": "{...}" },
{ "product": "ACC Shopee Affiliate", "unitPrice": 90000, "credential": "user2@mail.com|matkhau|...", "json": null }
]
}
}Mua nhiều sản phẩm một lần: gửi mảng { "items": [ { "productId": "...", "quantity": 1 } ] }
5. Mã lỗi
| HTTP | code | Ý nghĩa |
|---|---|---|
| 401 | missing_api_key / invalid_api_key | Thiếu hoặc sai API key |
| 403 | key_disabled | Key bị vô hiệu hoá |
| 404 | product_not_found / order_not_found | Không tìm thấy sản phẩm/đơn |
| 422 | order_failed | Hết hàng hoặc số dư ví không đủ |
Cần cấp API key?
Đăng ký một tài khoản trên vSon Store, nạp sẵn tiền vào ví, rồi liên hệ để được cấp key: Zalo 0366 54 1104 hoặc email havsonn@gmail.com.