Overview

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.

01
API Key

Use this for APIs that require authentication. Do not share this key.

Current key{api_key}
02
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.

GET / POST
Endpointhttps://www.tempcloud.shop/user/api/service.php
Không bắt buộc đăng nhập/api_key.
actstring · bắt buộc
act

Giá trị: list.

stockstring · không bắt buộc
stock

all hoặc available. Tham số cũ vẫn giữ.

stock_filterstring · không bắt buộc
stock_filter

Alias của stock, giữ tương thích.

typeofaccountstring · không bắt buộc
typeofaccount

facebook hoặc email nếu muốn lọc loại dịch vụ.

cURL
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"
Example response
{
    "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
}
03
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ả.

GET / POST
Endpointhttps://www.tempcloud.shop/user/api/service.php
Không bắt buộc đăng nhập/api_key. Endpoint chỉ trả thông tin sản phẩm public, không trả dữ liệu account raw.
actstring · bắt buộc
act

Giá trị: detail.

idinteger/string · bắt buộc
id

ID 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
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"
Example response
{
    "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
}
04
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.

POST
Endpointhttps://www.tempcloud.shop/user/api/order.php
Bắt buộc api_key hoặc phiên đăng nhập hợp lệ.
actstring · bắt buộc
act

Giá trị: paid.

api_keystring · bắt buộc
api_key

API key khách hàng.

service_idinteger/string · bắt buộc
service_id

Mã dịch vụ cần mua.

amountinteger · bắt buộc
amount

Số lượng cần mua.

return_datainteger · không bắt buộc
return_data

1 để trả account ngay trong response; giữ mặc định 1.

request_idstring · không bắt buộc
request_id

Mã idempotency từ client để tránh mua trùng khi retry.

cURL
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"
Example response
{
    "success": true,
    "message": "OK",
    "data": {
        "order_id": "ORDER_1684958785",
        "amount": 10,
        "accounts": [
            "uid|password|cookie"
        ]
    },
    "timespan": 1684958785
}
05
Error codes

Client nên kiểm tra success, sau đó đọc codemessage. Code 1xxx dành cho user/client; 2xxx dành cho admin/tool; 9xxx là lỗi hệ thống.

1000user
code

Bad request.

1001user
code

Invalid request method.

1002user
code

Missing action.

1003user
code

Unknown action.

1100user
code

Login or API key is required.

1101user
code

Invalid API key.

1102user
code

Session expired.

1200user
code

Invalid service.

1201user
code

Invalid amount.

1202user
code

Insufficient balance.

1203user
code

Service is out of stock.

1204user
code

Product ID is required.

1205user
code

Product was not found.

1300user
code

Too many requests.

1400user
code

Security token is invalid.

9000system
code

Database error.

9001system
code

Unexpected error.

9002system
code

System is under maintenance.