VI | EN
Nhắn Messenger
Dành cho developer

List of purchases — API Pancake POS

get /shops/{SHOP_ID}/purchases · gọi qua Quantri360 bằng một API key cho chính tài khoản / tài sản bạn đã kết nối và ủy quyền — 360 lo việc ký request và làm mới phiên đăng nhập bạn đã cấp.

get /shops/{SHOP_ID}/purchases

GET/shops/{SHOP_ID}/purchasesGọi qua 360: GET https://partner.quantri360.com/v1/pancake_pos/shops/{SHOP_ID}/purchases
Sắp mở. API này đã chạy thật qua 360 và đang được chốt giá — bạn có thể đọc tài liệu và chuẩn bị tích hợp trước.
Mô tả API

Danh sách phiếu nhập kho: kho nhập, NCC, tổng số lượng / giá trị, giảm giá, phí vận chuyển, trả trước NCC, trạng thái, từng dòng mẫu mã nhập (giá nhập, số lượng, tồn theo kho). Dùng để tính giá vốn, theo dõi hàng về và đối chiếu công nợ NCC.

  • Mỗi phiếu kèm đủ mẫu mã + tồn kho theo kho — phản hồi rất nặng; dùng page_size vừa phải (≤ 100).
  • Thời gian (inserted_at, time_import…) là UTC, không có hậu tố Z.
  • Phiếu nhập từ Excel (adjust_warehouse) thường có giá trị 0 — đừng dùng làm giá vốn.
  • Gọi thật: 9.252 phiếu; status=-1 → 0 phiếu, status=-2 → 9.252.

Request

Địa chỉ

GET https://partner.quantri360.com/v1/pancake_pos/shops/{SHOP_ID}/purchases

Xác thực & gian hàng

TênVị tríKiểuMẫuMô tả
AuthorizationheaderheaderBearer q360_live_ab12cd34_…Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand.
platform_shop_idquerystring1234567SHOP_ID đã nối — có thể bỏ khi đường dẫn có /shops/{SHOP_ID}.

Tham số request

TênVị tríKiểuBắt buộcMẫuMô tả
SHOP_IDpathintegerCó1234567Mã cửa hàng đã nối với 360.
pagequeryintKhông1Trang, từ 1.
page_sizequeryintKhông30Số phiếu / trang (mặc định 30).
statusqueryintKhông-2-2 tất cả (mặc định) · -1 mới · 0 đã xác nhận · 1 đã nhập hàng · 2 đã hủy.
typequerystringKhôngproductLoại phiếu.
get_time_importqueryboolKhôngtruetrue = kèm time_import (thời điểm nhập hàng thực).

Phân trang

Tăng page tới total_pages. Phiếu mới nhất trước (display_id giảm dần).

Ví dụ request

curl -s "https://partner.quantri360.com/v1/pancake_pos/shops/1234567/purchases?page=1&page_size=30&status=-2&get_time_import=true" \
  -H "Authorization: Bearer $KEY"
Python
import requests

KEY = "q360_live_..."  # khóa API của brand
r = requests.get(
    "https://partner.quantri360.com/v1/pancake_pos/shops/1234567/purchases",
    params={
        "page": 1,
        "page_size": 30,
        "status": -2,
        "get_time_import": True
    },
    headers={"Authorization": f"Bearer {KEY}"},
    timeout=60,
)
print(r.status_code)
print(r.json())
Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/pancake_pos/shops/1234567/purchases');
for (const [k, v] of Object.entries({"page":1,"page_size":30,"status":-2,"get_time_import":true})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
  method: 'GET',
  headers: { Authorization: `Bearer ${KEY}` },
});
console.log(r.status, await r.json());
PHP
<?php
$key = 'q360_live_...'; // khóa API của brand
$url = 'https://partner.quantri360.com/v1/pancake_pos/shops/1234567/purchases' . '?' . http_build_query(['page' => 1, 'page_size' => 30, 'status' => -2, 'get_time_import' => 'true']);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key]);
$res = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo $status, "\n", $res;

Response

Tham số phản hồi (nguyên của Pancake POS)

TênKiểuMẫuMô tả
successbooltrue
dataobject[]Phiếu nhập.
idstring28a2aad4-…Mã phiếu (UUID).
display_idint9253Số phiếu hiển thị.
statusint1`-1` mới · `0` đã xác nhận · `1` đã nhập hàng · `2` đã hủy.
created_typestringadjust_warehouseNguồn phiếu: `adjust_warehouse` (nhập từ Excel / điều chỉnh tồn), `actual_purchase` (nhập mua thật)…
warehouse_idstringKho nhập.
warehouseobjectid, name, custom_id.
supplier_products_idintMã NCC (null nếu không gắn).
total_quantityint3Tổng số lượng nhập.
total_remain_quantityint3Số lượng còn tồn từ phiếu.
total_priceint0Tổng giá trị nhập (VND).
total_gross_priceint0Tổng giá gốc trước giảm.
total_remain_priceint0Giá trị còn tồn.
discountintGiảm giá phiếu.
transport_feeint0Phí vận chuyển.
costs_incurredint0Chi phí phát sinh.
prepaid_debtintĐã trả trước NCC.
time_importstring2025-04-03T14:09:33.727520Thời điểm nhập (UTC) — chỉ có khi get_time_import=true.
inserted_atstring2025-04-03T14:09:33Tạo phiếu (UTC).
updated_atstring
notestringGhi chú.
userobjectNgười tạo: id, name, fb_id.
tagsint[]
imagesstring[][]
itemsobject[]Dòng nhập.
variation_idstringMã mẫu mã.
quantityint3SL nhập.
remain_quantityint3SL còn.
imported_priceintGiá nhập / đơn vị.
discountint0
tax_ratenumber0
variationobjectMẫu mã: display_id, barcode, retail_price, product{name, display_id}, variations_warehouses[] (remain_quantity, actual_remain_quantity, avg_price… theo kho).
page_number / page_size / total_pages / total_entriesintPhân trang.

Mẫu phản hồi

{
  "success": true,
  "data": [
    {
      "id": "28a2aad4-dc1b-4c42-98e6-ec0600e80000",
      "display_id": 9253,
      "status": 1,
      "created_type": "adjust_warehouse",
      "warehouse_id": "6d1b3245-31a2-4d2b-a3c1-c96f5c8b0000",
      "warehouse": {
        "id": "6d1b3245-31a2-4d2b-a3c1-c96f5c8b0000",
        "name": "Kho tổng HN",
        "custom_id": null
      },
      "supplier_products_id": null,
      "total_quantity": 3,
      "total_remain_quantity": 3,
      "total_price": 0,
      "total_gross_price": 0,
      "total_remain_price": 0,
      "transport_fee": 0,
      "costs_incurred": 0,
      "discount": null,
      "prepaid_debt": null,
      "time_import": "2025-04-03T14:09:33.727520",
      "inserted_at": "2025-04-03T14:09:33",
      "note": "Tự động nhập khi tải lên file excel",
      "user": {
        "id": "94348f65-…",
        "name": "Nhân viên A"
      },
      "items": [
        {
          "variation_id": "114257e4-…",
          "quantity": 3,
          "remain_quantity": 3,
          "discount": 0,
          "tax_rate": 0,
          "variation": {
            "display_id": "4",
            "barcode": "16190000",
            "retail_price": 698000,
            "product": {
              "name": "Chân váy A",
              "display_id": "WT20035J"
            },
            "variations_warehouses": [
              {
                "warehouse_id": "6d1b3245-…",
                "remain_quantity": 3,
                "actual_remain_quantity": 3,
                "total_quantity": 3
              }
            ]
          }
        }
      ]
    }
  ],
  "page_size": 30,
  "total_pages": 309,
  "page_number": 1,
  "total_entries": 9252
}

Bắt đầu dùng

  1. Đăng ký tài khoản Partner
  2. Mở loại dữ liệu thuộc nhóm Kho ở trang nền tảng
  3. Tạo API key (tick kênh Pancake POS)
  4. Gọi theo ví dụ ở trên