{
  "info": {
    "_postman_id": "fag-public-api-v1-001",
    "name": "ThapCamMMO API",
    "description": "Public REST API cho reseller / bot.\n\nCách đấu:\n1. Điền `baseUrl` + `apiKey` (tạo key tại Trang cá nhân).\n2. Header `X-API-Key`.\n3. `GET /v1/services` → copy field `id` vào biến `serviceId`.\n4. Tạo đơn bằng `POST /v1/orders` — không gửi `serviceType`.\n5. Lưu `orderCode` trong response, tra cứu `GET /v1/orders/:orderCode`.\n\nLưu ý:\n- `quantity` là số JSON (100), không phải chuỗi \"100\".\n- Catalog: `purchaseMode=checkout` mới đặt được. `pricingMode=options` bắt buộc `pricingOptionId` từ `meta.pricingOptions[].id`.\n- Rate limit: 100 req/phút.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl", "value": "https://api.thapcammmo.vn" },
    { "key": "apiKey", "value": "fag_YOUR_API_KEY_HERE" },
    { "key": "orderCode", "value": "AMXKQT260723102045" },
    { "key": "serviceId", "value": "1" },
    { "key": "pricingOptionId", "value": "665f1a2b3c4d5e6f7a8b9c0d" }
  ],
  "auth": {
    "type": "apikey",
    "apikey": [
      { "key": "key", "value": "X-API-Key", "type": "string" },
      { "key": "value", "value": "{{apiKey}}", "type": "string" },
      { "key": "in", "value": "header", "type": "string" }
    ]
  },
  "item": [
    {
      "name": "Balance",
      "item": [
        {
          "name": "Get balance",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/balance",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "balance"]
            },
            "description": "Số dư ví. API trừ tiền ví khi tạo đơn."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Services",
      "item": [
        {
          "name": "List all services",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/services",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "services"]
            },
            "description": "Copy field `id` → dùng làm serviceId lúc tạo đơn. `price` đã giảm theo cấp bậc."
          },
          "response": []
        },
        {
          "name": "List services by type",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/services?serviceType=add_member",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "services"],
              "query": [
                {
                  "key": "serviceType",
                  "value": "add_member",
                  "description": "add_member | sell_group | sell_proxy | sell_buff | sell_catalog"
                }
              ]
            },
            "description": "sell_catalog gồm software-mkt, source-code, mkt-fb, course — xem meta.kind."
          },
          "response": []
        }
      ]
    },
    {
      "name": "Orders",
      "item": [
        {
          "name": "List my orders",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/orders?page=1&pageSize=10",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "orders"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "pageSize", "value": "10" },
                { "key": "status", "value": "", "disabled": true },
                { "key": "serviceType", "value": "", "disabled": true }
              ]
            }
          },
          "response": []
        },
        {
          "name": "Get order by orderCode",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/v1/orders/{{orderCode}}",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "orders", "{{orderCode}}"]
            },
            "description": "Dùng orderCode trong response tạo đơn, không dùng Mongo _id."
          },
          "response": []
        },
        {
          "name": "Create — Tăng thành viên nhóm Zalo",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"serviceId\": \"{{serviceId}}\",\n  \"groupLinks\": [\"https://zalo.me/g/xxxx\"],\n  \"quantity\": 100\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/v1/orders",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "orders"]
            },
            "description": "serviceType=add_member. quantity = số thành viên mỗi link. groupLinks là mảng."
          },
          "response": []
        },
        {
          "name": "Create — Mua nhóm Zalo",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"serviceId\": \"{{serviceId}}\",\n  \"quantity\": 1\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/v1/orders",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "orders"]
            },
            "description": "serviceType=sell_group. quantity = số gói."
          },
          "response": []
        },
        {
          "name": "Create — Proxy",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"serviceId\": \"{{serviceId}}\",\n  \"quantity\": 1\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/v1/orders",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "orders"]
            },
            "description": "serviceType=sell_proxy. quantity trong meta.buyMin … min(buyMax, storeQuantity)."
          },
          "response": []
        },
        {
          "name": "Create — Tăng tương tác MXH",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"serviceId\": \"{{serviceId}}\",\n  \"buffLink\": \"https://example.com/post\",\n  \"quantity\": 1000\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/v1/orders",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "orders"]
            },
            "description": "serviceType=sell_buff. quantity trong meta.min … meta.max. Thêm buffComments khi meta.type chứa custom comments."
          },
          "response": []
        },
        {
          "name": "Create — Catalog giá cố định",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"serviceId\": \"{{serviceId}}\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/v1/orders",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "orders"]
            },
            "description": "meta.pricingMode=one_time và purchaseMode=checkout. Không gửi quantity."
          },
          "response": []
        },
        {
          "name": "Create — Catalog có gói giá",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"serviceId\": \"{{serviceId}}\",\n  \"pricingOptionId\": \"{{pricingOptionId}}\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/v1/orders",
              "host": ["{{baseUrl}}"],
              "path": ["v1", "orders"]
            },
            "description": "meta.pricingMode=options. pricingOptionId = meta.pricingOptions[].id (Mongo id), không phải serviceId."
          },
          "response": []
        }
      ]
    }
  ]
}
