Dùng API để lấy danh sách dịch vụ và mua hàng. Field cũ vẫn giữ nguyên; field mới chỉ bổ sung để client mới đọc thuận tiện hơn.
API Key
Use this for APIs that require authentication. Do not share this key.
{api_key}Lấy danh sách dịch vụ
Trả danh sách dịch vụ đang mở bán, giá, tồn kho và các thống kê public. Tương thích client cũ gọi POST; client mới có thể gọi GET.
https://www.tempcloud.shop/user/api/service.phpactGiá trị: list.
stockall hoặc available. Tham số cũ vẫn giữ.
stock_filterAlias của stock, giữ tương thích.
typeofaccountfacebook hoặc email nếu muốn lọc loại dịch vụ.
curl -X GET "https://www.tempcloud.shop/user/api/service.php?act=list"
curl -X POST "https://www.tempcloud.shop/user/api/service.php" \
-d "act=list"{
"success": true,
"message": "OK",
"data": [
{
"id": 1,
"name": "Clone US",
"price": 300,
"status": 1,
"total": 1000,
"total_available": 850,
"total_sold": 100,
"total_unsold": 900,
"total_die_unsold": 50
}
],
"timespan": 1684958785
}Lấy detail sản phẩm
Trả detail một sản phẩm/dịch vụ đang mở bán theo id. Dùng cho modal mua hàng, client API hoặc trang storefront cần xem rõ price, stock, giới hạn min/max và mô tả.
https://www.tempcloud.shop/user/api/service.phpactGiá trị: detail.
idID sản phẩm/dịch vụ cần lấy detail. Thiếu id trả code 1204 PRODUCT_ID_REQUIRED; không tìm thấy hoặc đang khóa trả code 1205 PRODUCT_NOT_FOUND.
curl -X GET "https://www.tempcloud.shop/user/api/service.php?act=detail&id=1"
curl -X POST "https://www.tempcloud.shop/user/api/service.php" \
-d "act=detail" \
-d "id=1"{
"success": true,
"message": "OK",
"data": {
"id": 1,
"name": "Clone US",
"price": 300,
"status": 1,
"status_label": "Active",
"description": "",
"geo": "US",
"typeofaccount": "facebook",
"set_min": 0,
"min_value": 0,
"set_max": 0,
"max_value": 0,
"total": 1000,
"total_available": 850,
"total_sold": 100,
"total_unsold": 900,
"total_die_unsold": 50
},
"timespan": 1684958785
}Mua hàng
Tạo đơn mua hàng. Hệ thống trừ tiền trong transaction và trả dữ liệu account nếu đủ tồn kho.
https://www.tempcloud.shop/user/api/order.phpactGiá trị: paid.
api_keyAPI key khách hàng.
service_idMã dịch vụ cần mua.
amountSố lượng cần mua.
return_data1 để trả account ngay trong response; giữ mặc định 1.
request_idMã idempotency từ client để tránh mua trùng khi retry.
curl -X POST "https://www.tempcloud.shop/user/api/order.php" \
-d "act=paid" \
-d "api_key={api_key}" \
-d "service_id=1" \
-d "amount=10"{
"success": true,
"message": "OK",
"data": {
"order_id": "ORDER_1684958785",
"amount": 10,
"accounts": [
"uid|password|cookie"
]
},
"timespan": 1684958785
}Error codes
Client nên kiểm tra success, sau đó đọc code và message. Code 1xxx dành cho user/client; 2xxx dành cho admin/tool; 9xxx là lỗi hệ thống.
codeBad request.
codeInvalid request method.
codeMissing action.
codeUnknown action.
codeLogin or API key is required.
codeInvalid API key.
codeSession expired.
codeInvalid service.
codeInvalid amount.
codeInsufficient balance.
codeService is out of stock.
codeProduct ID is required.
codeProduct was not found.
codeToo many requests.
codeSecurity token is invalid.
codeDatabase error.
codeUnexpected error.
codeSystem is under maintenance.