Chuyển tới nội dung chính

Danh sách đơn hàng bán

1. Thông tin API

  • Endpoint: /api/v6.1/sale_orders
  • Method: GET
  • Authentication: Yêu cầu X-API-KEY
  • Header:
    • X-API-KEY: <your_api_key>

2. Tham số Request

2.1. Filtering (Lọc dữ liệu)

TrườngHỗ trợKiểu dữ liệuMô tả
ideq, inintegerLọc theo ID đơn hàng
order_dategte, lte, eq, betweentimestampLọc theo ngày đặt hàng
created_ateq, gte, ltetimestampLọc theo ngày tạo đơn
updated_ateq, gte, ltetimestampLọc theo ngày sửa đơn

2.2. Sorting (Sắp xếp dữ liệu)

TrườngHướng
idasc, desc
order_dateasc, desc

2.3. Pagination (Phân trang)

Tham sốKiểu dữ liệuMô tả
limitintegerSố bản ghi cần lấy
offsetintegerSố bản ghi cần bỏ qua

3. Response Mẫu

{
"data": [
{
"id": 1,
"order_code": "DH_XXXXX",
"real_amount": 83706.5,
"f_amount": 0,
"discount": 10,
"discount_amount": 6435,
"vat_amount": 5791.5,
"account_id": 12033,
"account_code": "KH/2025/xxxxx",
"account_email": "[email protected]",
"account_phone": "0877200xxxx",
"account_address": "xxxxx - xxxxxx - xxxxx",
"order_date": "2025-03-12",
"created_at": "2025-03-12 08:53:00",
"updated_at": "2025-03-12 08:53:00",
"status": 1,
"assigned_user": 2,
"assigned_user_name": "Nguyễn Văn A",
"safebook_synchronized": 0,
"contact_name": "Nguyễn Văn A",
"contact_phone": "0877200XXXX",
"contact_email": "[email protected]",
"store_id": 2,
"lading_code": "BE.01921.1282",
"lading_status": "",
"has_pay_off": 0,
"custom_fields": {
"gui_tin_nhan_xac_nhan_don_hang": 6,
"so_ne": "0",
"chu_ne": "Demo"
},
"order_details": [
{
"id": 286,
"product_id": 2507,
"product_code": "SP2507",
"product_name": "GF SP Có giá sỉ + lẻ",
"note": "Sản phẩm dễ vỡ",
"unit_id": 14,
"services": 0,
"unit_name": "Dịch vụ",
"quantity": 1,
"price": 65000,
"product_sale_off": 1,
"cash_discount": 650,
"vat": 0,
"vat_amount": 0,
"amount": 64350,
"origin_amount": 65000,
"product_avatar": "https://xxxx.getflycrm.com/assets/images/common/no_image.png"
}
],
"tracking_url": "",
"lading_status_title": "",
"payment_status": "Chưa thanh toán",
"status_label": "Chờ duyệt",
"lading_info": {
"status": "",
"tracking_url": ""
}
}
],
"has_more": true,
"offset": 0,
"limited": 1,
"sorted": { "id": "DESC" }
}

4. Mô tả các Trường Dữ Liệu

4.1. Thông tin Đơn hàng

TrườngKiểu dữ liệuMô tả
idintegerID đơn hàng
order_codestringMã đơn hàng
real_amountfloatTổng tiền sau giảm giá
discountfloat% Giảm giá
vat_amountfloatTiền VAT
order_datetimestampNgày đặt hàng
statusintegerTrạng thái đơn hàng
status_labelstringNhãn trạng thái
payment_statusstringTrạng thái thanh toán
lading_codestringMã vận đơn
lading_status_titlestringTrạng thái vận đơn
tracking_urlstringURL theo dõi vận đơn

4.2. Thông tin Khách hàng

TrườngKiểu dữ liệuMô tả
account_idintegerID khách hàng
account_codestringMã khách hàng
account_emailstringEmail khách hàng
account_phonestringSĐT khách hàng
account_addressstringĐịa chỉ khách hàng

4.3. Chi tiết Sản phẩm

TrườngKiểu dữ liệuMô tả
product_idintegerID sản phẩm
product_codestringMã sản phẩm
product_namestringTên sản phẩm
quantityintegerSố lượng
pricefloatGiá sản phẩm
amountfloatTổng tiền

5. Ghi chú

  • Trường custom_fields chứa các dữ liệu tùy chỉnh của đơn hàng.
  • Nếu cần lọc dữ liệu nâng cao, có thể kết hợp các tham số filtering, sorting, limit, offset.