# Đơn hàng

> Base URL: `https://pos.pages.fm/api/v1`. Xác thực bằng tham số truy vấn `api_key`.

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

`GET /shops/{SHOP_ID}/orders`

Lấy danh sách đơn hàng thông tin từng đơn hàng cụ thể

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |
| `page_size` | query | integer |  | Kích thước trang |
| `page_number` | query | integer |  | Số trang |
| `search` | query | string |  | Số điện thoại, tên khách hàng, ghi chú, ... |
| `filter_status[]` | query | integer[] |  | Trạng thái đơn hàng |
| `include_removed` | query | integer |  | Bao gồm đơn đã xóa |
| `updateStatus` | query | string |  | Lọc đơn hàng theo thời gian Values: `inserted_at` Thời điểm tạo đơn, `updated_at` Thời điểm cập nhật cuối, `partner_inserted_at` Thời điểm gửi đơn vị vận chuyển, `paid_at` Thời điểm đối soát, `estimate_delivery_date` Thời gian giao hàng dự kiến, `picked_up_at` Thời điểm đơn vị vận chuyển lấy hàng, `first_delivery_at` Thời điểm giao hàng lần đầu, `transfer_proof` Chứng từ chuyển khoản, `time_assign_seller` Thời điểm phân công người bán, `time_assign_care` Thời điểm phân công chăm sóc, `time_assign_marketer` Thời điểm phân công marketer, `-1` Cập nhật trạng thái cuối, `0` Mới, `11` Chờ hàng, `20` Đã đặt hàng, `1` Đã xác nhận, `12` Chờ in, `13` Đã in, `8` Đang đóng hàng, `9` Chờ chuyển hàng, `2` Đã gửi hàng, `3` Đã nhận, `16` Đã thu tiền, `4` Đang hoàn, `15` Hoàn một phần, `5` Đã hoàn. |
| `startDateTime` | query | integer (int64) |  | Ngày bắt đầu |
| `endDateTime` | query | integer (int64) |  | Ngày kết thúc |
| `option_sort` | query | string |  | Thứ tự đơn hàng Values: `inserted_at_desc` Thời điểm tạo đơn giảm dần, `inserted_at_asc` Thời điểm tạo đơn tăng dần, `last_updated_order_desc` Cập nhật đơn hàng cuối giảm dần, `last_updated_order_asc` Cập nhật đơn hàng cuối tăng dần, `last_update_status_at_desc` Cập nhật trạng thái cuối giảm dần, `last_update_status_at_asc` Cập nhật trạng thái cuối tăng dần, `order_valuation_desc` Giá trị đơn hàng giảm dần, `order_valuation_asc` Giá trị đơn hàng tăng dần, `product_quantity_desc` Số lượng sản phẩm giảm dần, `product_quantity_asc` Số lượng sản phẩm tăng dần, `product_name_desc` Tên sản phẩm giảm dần, `product_name_asc` Tên sản phẩm tăng dần, `sub_status_sort_desc` Cập nhật chậm giao hàng giảm dần, `sub_status_sort_asc` Cập nhật chậm giao hàng tăng dần, `first_undeliverable_at_desc` Lần đầu không giao được giảm dần, `first_undeliverable_at_asc` Lần đầu không giao được tăng dần, `customer_sort_desc` Tên khách hàng giảm dần, `customer_sort_asc` Tên khách hàng tăng dần, `estimate_delivery_date_desc` Ngày giao hàng dự kiến giảm dần, `estimate_delivery_date_asc` Ngày giao hàng dự kiến tăng dần, `order_source_desc` Nguồn đơn hàng giảm dần, `order_source_asc` Nguồn đơn hàng tăng dần. |
| `fields[]` | query | string[] |  | Các trường trả về |
| `partner_id[]` | query | integer[] |  | ID đơn vị vận chuyển trên hệ thống Pancake |
| `shop_partner_account` | query | integer |  | Lọc theo mã tài khoản vận chuyển đã kết nối với shop |
| `customer_id` | query | string |  | Mã khách hàng |
| `order_sources[]` | query | string[][] |  | Nguồn đơn hàng. Định dạng: [[mã_nguồn_đơn, mã_tài_khoản], ...] Ví dụ: [["-1", "314"], ["-3"]] |
| `is_filter_exclude_source` | query | boolean |  | Loại trừ nguồn đơn hàng |
| `ad_ids[]` | query | string[] |  | Mã quảng cáo |
| `project_ids` | query | integer |  | Mã dự án |
| `extra_fields[]` | query | string[] |  | Các trường bổ sung |

### Phản hồi

- `200` Success (object)

```json
{
  "data": [
    {
      "id": 1418,
      "system_id": 1,
      "shop_id": 4,
      "inserted_at": "2020-05-12T04:51:42",
      "updated_at": "2020-05-12T04:51:54",
      "status": 0,
      "status_name": "new",
      "bill_full_name": "Hoang Anh",
      "bill_phone_number": "0999999999",
      "bill_email": "customer@example.com",
      "conversation_id": "117967746266487_9306266852780716",
      "page_id": "256469571178082",
      "post_id": "185187094667903_477083092110915",
      "ad_id": "23851252560290199",
      "shipping_fee": 0,
      "cod": 0,
      "cash": 0,
      "account": 1,
      "total_discount": 0,
      "note": "",
      "note_print": null,
      "received_at_shop": false,
      "is_free_shipping": false,
      "is_locked": false,
      "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
      "creator": {
        "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "fb_id": "2042723249341651",
        "name": "Hoang Anh",
        "avatar_url": null
      },
      "items": [],
      "partner": {
        "partner_id": 1,
        "cod": 0,
        "extend_code": "S58824.MB25.C3.500020713",
        "total_fee": 0,
        "updated_at": "2020-05-12T05:18:16",
        "delivery_name": null,
        "delivery_tel": null,
        "picked_up_at": null,
        "sort_code": null,
        "paid_at": null,
        "system_created": true,
        "partner_status": "request_received",
        "partner_name": "Shopee Xpress",
        "first_delivery_at": null,
        "first_undeliverable_at": "2025-06-30T06:41:44",
        "count_of_delivery": 1,
        "order_number_vtp": null,
        "printed_form": null,
        "extend_update": [
          {
            "key": "status",
            "status": "delivered",
            "tracking_id": "S58824.MB25.C3.500020713",
            "note": "",
            "update_at": "2020-05-12T05:18:16",
            "webhook_params": null
          }
        ]
      },
      "shipping_address": {
        "full_name": "Hoang Anh",
        "phone_number": "0999999999",
        "address": "90 Cầu Giấy",
        "full_address": "90 Cầu Giấy, Phường Dịch Vọng, Quận Cầu Giấy, Hà Nội",
        "province_id": "101",
        "district_id": "10113",
        "commune_id": "1011309"
      },
      "additional_info": {
        "service_partner": "instant"
      },
      "invoice_info_list": [
        {
          "error": "",
          "invoice_detail": {
            "company_address": "85 lê quý đôn, phường nam định, tỉnh Ninh Bình",
            "company_address_breakdown": {
              "company_additional_info": "",
              "company_barangay": "",
              "company_city": "",
              "company_detailed_address": "85 lê quý đôn, phường nam định, tỉnh Ninh Bình",
              "company_district": "Phường Nam Định",
              "company_full_address": "85 lê quý đôn, phường nam định, tỉnh Ninh Bình",
              "company_postcode": "",
              "company_province": "",
              "company_region": "VietNam",
              "company_state": "Ninh Bình",
              "company_town": "Phường Nam Định"
            },
            "company_email": "acb@gmail.com",
            "company_name": "Công ty cổ phần tư vấn xây dựng điện Hoàng Phát",
            "company_tax_id": "0601043840"
          },
          "invoice_type": "company",
          "is_requested": true,
          "order_sn": "251121BVGU6RVE"
        }
      ],
      "reports_by_phone": {
        "+639175706297": {
          "order_fail": 29,
          "order_success": 20,
          "warning": 0
        }
      },
      "p_utm_source": "fb",
      "p_utm_medium": "paid",
      "p_utm_campaign": "120236828168640593",
      "p_utm_term": "120236828168790593",
      "p_utm_content": "120236828168960593",
      "link": "https://www.myfahathai.com/doc?fbclid=IwZXh0bgNhZW0BMABhZGlkAasqwhnoX"
    }
  ],
  "page_number": 1,
  "page_size": 100,
  "success": true,
  "total_entries": 1418,
  "total_pages": 15
}
```

## Tạo đơn hàng

`POST /shops/{SHOP_ID}/orders`

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |

### Nội dung yêu cầu

Thông tin đơn hàng cần tạo

- `id` (integer): Mã đơn hàng
- `system_id` (integer): Mã hệ thống
- `shop_id` (integer, required): Mã cửa hàng
- `inserted_at` (string (date-time)): Thời điểm tạo đơn
- `updated_at` (string (date-time)): Thời điểm cập nhật đơn
- `status` (integer): Trạng thái đơn hàng Values: `0` Mới, `17` Chờ xác nhận, `11` Chờ hàng, `12` Chờ in, `13` Đã in, `20` Đã đặt hàng, `1` Đã xác nhận, `8` Đang đóng hàng, `9` Chờ chuyển hàng, `2` Đã gửi hàng, `3` Đã nhận, `16` Đã thu tiền, `4` Đang hoàn, `15` Hoàn một phần, `5` Đã hoàn, `6` Đã hủy, `7` Đã xóa.
- `status_name` (string): Tên trạng thái đơn hàng
- `bill_full_name` (string): Tên khách hàng
- `bill_phone_number` (string): SĐT khách hàng
- `bill_email` (string): Email khách hàng
- `conversation_id` (string): Mã hội thoại
- `page_id` (string): Mã Facebook page
- `post_id` (string): Mã bài viết
- `ad_id` (string): Mã quảng cáo
- `shipping_fee` (integer): Phí vận chuyển
- `partner_fee` (integer): Phí vận chuyển từ ĐVVC
- `fee_marketplace` (integer): Phí sàn
- `customer_pay_fee` (boolean): Khách trả phí ship
- `is_free_shipping` (boolean): Miễn phí vận chuyển
- `is_livestream` (boolean): Đơn hàng từ livestream
- `is_live_shopping` (boolean): Đơn hàng từ live shopping
- `is_smc` (boolean): Đơn hàng từ mua sắm trên Messenger
- `received_at_shop` (boolean): true: Bán tại quầy, false: Bán online
- `total_discount` (integer): Tổng tiền giảm giá
- `note` (string): Ghi chú nội bộ
- `note_print` (string): Ghi chú đơn hàng
- `returned_reason` (integer): Mã lý do hoàn hàng (1: Do khách hàng, 2: Do nhân viên, 3: Do sản phẩm lỗi, 4: Do đơn vị vận chuyển, 5: Do đổi hàng). Mã khác là lý do tùy chỉnh theo từng shop, xem tên hiển thị tại returned_reason_name
- `returned_reason_name` (string): Tên lý do hoàn hàng
- `sub_status` (integer): Lý do delay giao hàng
- `warehouse_id` (string): Mã kho hàng
- `warehouse_info` (object): Thông tin kho hàng
  - `name` (string): Tên kho hàng
  - `phone_number` (string): Số điện thoại kho hàng
  - `full_address` (string): Địa chỉ đầy đủ kho hàng
  - `address` (string): Địa chỉ chi tiết kho hàng
  - `province_id` (string): Mã tỉnh thành phố
  - `district_id` (string): Mã quận huyện
  - `commune_id` (string): Mã phường xã
  - `affiliate_id` (string): Mã đại lý
  - `ffm_id` (string): Mã FFM
  - `has_snappy_service` (boolean): Có dịch vụ Snappy
  - `custom_id` (string): Mã tùy chỉnh
- `creator_id` (string): Mã người tạo
- `creator` (object): Thông tin người tạo đơn
  - `id` (string): Mã người tạo
  - `fb_id` (string): ID facebook người tạo đơn
  - `name` (string): Tên người tạo đơn
  - `avatar_url` (string): Link avatar người tạo
- `items` (object[]): Danh sách sản phẩm
  - `product_id` (string): Mã sản phẩm
  - `quantity` (integer, required): Số lượng
  - `returned_count` (integer): Số lượng đã trả
  - `assigning_seller_id` (string): Mã nhân viên được phân công
  - `quantity_by_combo_products` (object[]): Số lượng theo combo sản phẩm
  - `discount_each_product` (integer): Giảm giá cho từng sản phẩm
  - `is_bonus_product` (boolean): Sản phẩm tặng kèm
  - `is_discount_percent` (boolean): Giảm giá theo phần trăm
  - `is_wholesale` (boolean): Bán sỉ
  - `is_composite` (boolean): Sản phẩm composite
  - `one_time_product` (boolean): Sản phẩm một lần
  - `note` (string): Ghi chú sản phẩm
  - `note_product` (string): Ghi chú sản phẩm
  - `inserted_at` (string (date-time)): Thời điểm tạo
  - `measure_group_id` (integer): Mã nhóm đơn vị tính
  - `variation_info` (object): Thông tin biến thể. Không bắt buộc khi tạo/cập nhật đơn (backend tự coi là object rỗng nếu thiếu). Các field bên trong không bắt buộc riêng lẻ, nhưng nên gửi `retail_price` để giá dòng hàng đúng.
  - `components` (object[]): Thành phần sản phẩm
  - `variation_id` (string, required): Mã mẫu mã (có thể dùng SKU của mẫu mã)
- `partner` (object): Thông tin đơn vị vận chuyển Khi cập nhật đơn đã có thông tin vận chuyển, chỉ field được gửi mới được ghi; field không gửi giữ nguyên giá trị hiện tại. Gửi `null` để xoá `partner_id`, `extend_code` hoặc `shop_partner_id`.
  - `partner_id` (integer): ID đơn vị vận chuyển trên hệ thống Pancake
  - `cod` (integer): Đối soát tiền thu hộ
  - `extend_code` (string): Mã vận đơn
  - `total_fee` (integer): Tổng phí
  - `updated_at` (string (date-time)): Thời điểm cập nhật
  - `delivery_name` (string): Tên người giao hàng
  - `delivery_tel` (string): Số điện thoại người giao hàng
  - `picked_up_at` (string (date-time)): Thời điểm lấy hàng
  - `sort_code` (string): Mã phân loại
  - `paid_at` (string (date-time)): Thời điểm thanh toán
  - `system_created` (boolean): Được tạo bởi hệ thống
  - `extend_update` (object[]): Cập nhật từ đơn vị vận chuyển
  - `partner_status` (string): Trạng thái vận chuyển Values: `waiting` Chờ xử lý, `request_received` ĐVVC đã tiếp nhận đơn, `processing_picked_up` Đang xử lý lấy hàng, `picking_up` Đang lấy hàng, `delay_pickup` Trễ lấy hàng, `picked_up` Đã lấy hàng, `waiting_on_the_way` Chờ trung chuyển, `on_the_way` Đang trung chuyển, `contact_delivery_company` Liên hệ ĐVVC, `out_for_delivery` Đang giao hàng, `delay_delivery` Trễ giao hàng, `inform_recipient` Thông báo cho người nhận, `undeliverable` Giao không thành, `waiting_for_return` Chờ chuyển hoàn, `delivered` Đã giao hàng, `delivered_cod` Đã giao hàng, đã đối soát COD, `returning` Đang chuyển hoàn, `returned` Đã chuyển hoàn, `returned_cod` Đã chuyển hoàn, đã đối soát COD, `canceled` Đã hủy vận đơn.
  - `partner_name` (string): Tên đơn vị vận chuyển
  - `first_delivery_at` (string (date-time)): Thời điểm giao hàng lần đầu
  - `first_undeliverable_at` (string (date-time)): Thời điểm giao hàng thất bại lần đầu
  - `count_of_delivery` (integer): Số lần đi giao. Cập nhật từ đơn vị vận chuyển tự cộng 1 mỗi lần vận đơn chuyển sang `out_for_delivery` hoặc `delay_delivery`. Có thể ghi khi tạo hoặc cập nhật đơn (số nguyên 0-32767); bỏ qua hoặc giá trị không hợp lệ thì giữ giá trị hiện tại, các lần cập nhật sau từ đơn vị vận chuyển tiếp tục đếm từ giá trị đã ghi.
  - `order_number_vtp` (string): Mã vận đơn Viettel Post
  - `printed_form` (object): Mẫu in
- `shipping_address` (ShippingAddress): 
  - `address` (string): Địa chỉ. Khi tạo đơn qua API, nếu có `address` nhưng `province_id` để trống, hệ thống sẽ tự động phân tích địa chỉ dạng văn bản này để điền `province_id`, `district_id` và `commune_id`. Bỏ qua tự động điền nếu địa chỉ thuộc Thái Lan (mã quốc gia 66) hoặc không xác định được phường/xã từ nội dung.
  - `commnue_name` (string): Tên phường/xã
  - `commune_id` (string): Mã phường/xã
  - `country_code` (string): Mã quốc gia
  - `district_id` (string): Mã quận/huyện
  - `district_name` (string): Tên quận/huyện
  - `full_address` (string): Địa chỉ đầy đủ
  - `full_name` (string): Họ và tên
  - `new_full_address` (string): Địa chỉ đầy đủ mới
  - `new_province_id` (string): Mã tỉnh/thành mới
  - `phone_number` (string): Số điện thoại
  - `post_code` (string): Mã bưu điện
  - `province_id` (string): Mã tỉnh/thành
  - `province_name` (string): Tên tỉnh/thành
  - `render_type` (string): Loại hiển thị
- `payment_purchase_histories` (object[]): Lịch sử thanh toán
  - `amount` (integer): Số tiền
  - `type` (string): Loại thanh toán
  - `inserted_at` (string (date-time)): Thời điểm giao dịch
  - `result_code` (string): Mã kết quả
  - `ipn_reply` (boolean): Phản hồi IPN
  - `voucher_amount` (integer): Số tiền voucher
  - `tags` (string[]): Thẻ
- `tags` (object[]): Danh sách thẻ đơn hàng
  - `id` (integer): Mã thẻ đơn hàng
  - `name` (string): Tên thẻ đơn hàng
- `marketer` (object): Thông tin marketer
  - `id` (string): Mã marketer
  - `name` (string): Tên marketer
  - `email` (string): Email marketer
  - `phone_number` (string): Số điện thoại marketer
  - `fb_id` (string): Facebook ID marketer
  - `avatar_url` (string): Link avatar marketer
- `pke_mkter` (string): Mã nhân viên marketer
- `activated_combo_products` (object): Thông tin combo sản phẩm được kích hoạt
  - `combo_product_id` (integer): Mã combo sản phẩm
  - `quantity_combo_activated` (integer): Số lượng combo được kích hoạt
  - `combo_product_info` (object): Thông tin combo sản phẩm
- `activated_promotion_advances` (object[]): Thông tin khuyến mãi được kích hoạt
  - `id` (integer): Mã
  - `promotion_advance_id` (string): Mã khuyến mãi
  - `promotion_advance_info` (object): Thông tin khuyến mãi
- `invoice_info_list` (object[]): Danh sách thông tin hóa đơn
  - `error` (string): Thông báo lỗi nếu có
  - `invoice_detail` (object): Chi tiết thông tin hóa đơn. Các trường cần truyền phụ thuộc vào `invoice_type`: - `company` (tổ chức): dùng `company_name`, `company_tax_id`, `company_address`, `company_email` (và `company_address_breakdown` nếu có). - `personal` (cá nhân): dùng `name`, `phone_number`, `identity_code`, `tax_id`, `email`.
  - `invoice_type` (string): Loại hóa đơn: `company` xuất cho tổ chức/công ty, `personal` xuất cho cá nhân. Quyết định các trường trong `invoice_detail` được sử dụng. Values: `company`, `personal`.
  - `is_requested` (boolean): Khách yêu cầu xuất hóa đơn điện tử cho đơn này. Truyền `true` cùng `invoice_type` và `invoice_detail` để yêu cầu xuất hóa đơn.
  - `order_sn` (string): Mã đơn hàng trên sàn
- `reports_by_phone` (object): Báo cáo theo số điện thoại
  - `order_fail` (integer): Số đơn thất bại
  - `order_success` (integer): Số đơn thành công
  - `warning` (integer): Số đơn cảnh báo
- `tracking_link` (string): Link xác nhận đơn hàng
- `payment_link` (string): Link thanh toán
- `ads_source` (string): Nguồn quảng cáo
- `bank_payments` (object): Phương thức thanh toán
- `transfer_proofs` (object[]): Danh sách chứng từ xác thực chuyển khoản, gồm ngày giờ xác thực, số tiền và ảnh chứng từ
  - `id` (integer): Mã chứng từ chuyển khoản
  - `order_id` (integer): Mã đơn hàng
  - `shop_id` (integer): Mã cửa hàng
  - `payment_id` (string): Mã phương thức thanh toán ngân hàng (trùng với key trong `bank_payments`)
  - `amount` (integer): Số tiền chuyển khoản
  - `images` (string[]): Danh sách ảnh chứng từ chuyển khoản
  - `note` (string): Ghi chú
  - `is_income` (boolean): Là khoản tiền nhận vào (true) hay chi ra (false)
  - `is_verify` (boolean): Chứng từ đã được xác thực hay chưa
  - `verify_at` (string (date-time)): Thời điểm xác thực chuyển khoản
  - `verifier` (object): Thông tin người xác thực
  - `creator` (object): Thông tin người tạo chứng từ
  - `last_editor` (object): Thông tin người chỉnh sửa cuối
  - `order_info` (object): Thông tin đơn hàng bổ sung
  - `inserted_at` (string (date-time)): Thời điểm tạo chứng từ
  - `updated_at` (string (date-time)): Thời điểm cập nhật chứng từ
- `shopify_order_id` (string): Mã đơn hàng Shopify
- `shopify_abandon_checkout_id` (integer): Mã Shopify abandon checkout
- `is_abandoned_order` (boolean): Cờ đơn chưa hoàn tất khi tạo hoặc cập nhật đơn. Truyền trực tiếp trong body, không bọc trong `third_party` hoặc `third_party_infomation`. Giá trị truyền lên, kể cả `false`, được ưu tiên hơn kết quả nhận diện tự động. Nếu bỏ qua khi tạo đơn, cờ được xác định tự động; nếu bỏ qua khi cập nhật, giữ nguyên giá trị hiện tại. Chỉ boolean `true` hoặc chuỗi `"true"` được chuẩn hóa thành `true`; mọi giá trị khác được gửi lên đều thành `false`.
- `cod` (integer): Tiền thu hộ
- `cash` (integer): Tiền mặt
- `account` (integer): Mã nguồn đơn hàng
- `account_name` (string): Tên mã nguồn đơn
- `advanced_platform_fee` (object): Phí từ sàn thương mại điện tử
  - `ads_top_up` (integer): Ví quảng cáo
  - `affiliate_commission` (integer): Phí hoa hồng (Sàn TMĐT)
  - `diff_shipping_fee` (integer): Chênh lệch phí vận chuyển (Sàn TMĐT)
  - `marketplace_voucher` (integer): Sàn trợ giá
  - `payment_fee` (integer): Phí cố định, giao dịch (Sàn TMĐT)
  - `platform_commission` (integer): Phí hoa hồng nền tảng (Sàn TMĐT)
  - `seller_transaction_fee` (integer): Phí thanh toán (Sàn TMĐT)
  - `service_fee` (integer): Phí dịch vụ (Sàn TMĐT)
  - `sfp_service_fee` (integer): Phí dịch vụ SFP (Sàn TMĐT)
- `printing_count` (integer): Số lần in
- `money_to_collect` (integer): Số tiền cần thu
- `marketplace_id` (string): Mã sàn thương mại điện tử Values: `-2`, `-3`, `-4`, `-9`, `-16`, `-17`, `-20`, `-25`, `-27`, `-28`.
- `total_price` (integer): Tổng giá trị sản phẩm
- `shop_customer_address_id` (string): Mã địa chỉ khách hàng
- `customer` (object): Thông tin khách hàng
  - `fb_id` (string): Facebook ID khách hàng
  - `id` (string): Mã khách hàng
  - `name` (string): Tên khách hàng
  - `page_id` (string): Mã trang
- `total_quantity` (integer): Tổng số lượng
- `time_assign_marketer` (string (date-time)): Thời điểm phân công marketer
- `p_utm_source` (string): UTM Source
- `p_utm_medium` (string): UTM Medium
- `p_utm_campaign` (string): UTM Campaign
- `p_utm_term` (string): UTM Term
- `p_utm_content` (string): UTM Content
- `p_utm_id` (string): UTM ID
- `utm_affiliate` (string): Affiliate
- `link` (string): Link
- `status_history` (object[]): Lịch sử cập nhật trạng thái
  - `avatar_url` (string): Link avatar
  - `editor` (object): Thông tin người chỉnh sửa
  - `editor_fb` (string): Facebook ID người chỉnh sửa
  - `editor_id` (string): Mã người chỉnh sửa
  - `name` (string): Tên
  - `old_status` (integer): Trạng thái cũ
  - `status` (integer): Trạng thái
  - `updated_at` (string (date-time)): Thời điểm cập nhật
- `duplicated_phone` (boolean): Số điện thoại trùng lặp
- `order_currency` (string): Loại tiền tệ
- `charged_by_vnpay` (integer): Số tiền thanh toán qua VNPay
- `charged_by_qrpay` (integer): Số tiền khách thanh toán qua QRPAY
- `custom_id` (string): Mã tùy chỉnh
- `last_editor` (object): Thông tin người chỉnh sửa cuối cùng đơn hàng
  - `id` (string): Mã người chỉnh sửa
  - `fb_id` (string): Facebook ID người chỉnh sửa
  - `name` (string): Tên người chỉnh sửa
  - `email` (string): Email người chỉnh sửa
  - `avatar_url` (string): Link avatar người chỉnh sửa
  - `phone_number` (string): Số điện thoại người chỉnh sửa
- `last_editor_id` (string): Mã người sửa cuối
- `charged_by_momo` (integer): Số tiền khách thanh toán qua MOMO
- `prepaid_by_point` (object): Thanh toán bằng điểm thưởng
  - `money` (integer): Số tiền
  - `point` (integer): Số điểm
- `bank_transfer_images` (string (uri)[]): Hình ảnh chuyển khoản
- `transfer_money` (integer): Số tiền khách chuyển khoản
- `lock_order_by_user` (string): Mã người dùng khóa đơn hàng
- `assigning_care` (object): Nhân viên chăm sóc
  - `id` (string): Mã người chăm sóc
  - `fb_id` (string): Facebook ID người chăm sóc
  - `name` (string): Tên người chăm sóc
  - `email` (string): Email người chăm sóc
  - `avatar_url` (string): Link avatar người chăm sóc
  - `phone_number` (string): Số điện thoại người chăm sóc
- `assigning_care_id` (string): Mã nhân viên chăm sóc
- `time_assign_care` (string (date-time)): Thời điểm phân công chăm sóc
- `assigning_seller` (object): Nhân viên được phân công
  - `id` (string): Mã người bán
  - `fb_id` (string): Facebook ID người bán
  - `name` (string): Tên người bán
  - `email` (string): Email người bán
  - `avatar_url` (string): Link avatar người bán
  - `phone_number` (string): Số điện thoại người bán
- `einvoices` (EInvoice[]): 
  - `actual_shipping_fee` (integer): Phí vận chuyển
  - `adjust_amount` (integer): Phần trăm giảm trên doanh thu
  - `adjustment_criteria` (integer): Tiêu chí điều chỉnh Values: `1` Điều chỉnh số lượng, `2` Điều chỉnh đơn giá, `3` Điều chỉnh thuế suất, `4` Điều chỉnh tiền thuế.
  - `adjustment_type` (integer): Loại điều chỉnh Values: `1` Điều chỉnh tăng, `2` Điều chỉnh giảm, `3` Thông tin.
  - `allocation_discounts` (object[]): Phân bổ chiết khấu
  - `allocation_type` (integer): Loại phân bổ Values: `1` Theo đơn giá, `2` Tùy chỉnh.
  - `bank_account_number` (string): Số tài khoản ngân hàng
  - `bank_name` (string): Tên ngân hàng
  - `budget_unit_code` (string): Mã đơn vị ngân sách
  - `buyer_not_get_invoice` (boolean): Người mua không nhận hóa đơn
  - `creator` (object): Thông tin người tạo
  - `discount` (integer): Giảm giá chung
  - `display_id` (integer): Mã hiển thị
  - `einvoice_account_id` (integer): Mã tài khoản hóa đơn điện tử
  - `email` (string): Địa chỉ email
  - `full_name` (string): Tên người mua hàng
  - `id` (integer): ID hóa đơn
  - `identity_code` (string): Mã định danh người mua
  - `included_tax` (integer): Thuế đã bao gồm
  - `invoice_no` (string): Số hóa đơn
  - `invoice_series` (string): Ký hiệu hóa đơn
  - `invoice_type` (integer): Loại hóa đơn
  - `is_adjust_amount` (boolean): Có điều chỉnh số tiền
  - `is_included_tax` (boolean): Có bao gồm thuế
  - `items` (object[]): Danh sách sản phẩm hóa đơn
  - `key_search` (string): Mã tìm kiếm
  - `last_editor_id` (string): Mã người chỉnh sửa cuối
  - `note` (string): Ghi chú
  - `order_id` (integer): Mã đơn hàng
  - `order_info` (object): Thông tin đơn hàng
  - `original_einvoice` (object): Mã hóa đơn điện tử gốc
  - `payment_method` (string): Phương thức thanh toán
  - `phone_number` (string): Số điện thoại
  - `purchaser_tax_code` (string): Mã số thuế người mua
  - `purchaser_unit` (string): Đơn vị tính
  - `release_date` (string (date-time)): Ngày phát hành
  - `release_type` (integer): Loại phát hành
  - `shipping_address` (ShippingAddress): 
  - `shipping_fee` (integer): Phí vận chuyển
  - `shop_id` (integer): Mã shop
  - `signature_type` (integer): Loại chữ ký
  - `status` (integer): Trạng thái Values: `0` Chưa phát hành, `1` Chờ phát hành, `2` Đã phát hành, `3` Đã hủy, `4` Hoá đơn thay thế, `5` Hoá đơn bị thay thế, `6` Hoá đơn điều chỉnh, `7` Bị điều chỉnh.
  - `tax` (integer): Thuế suất
  - `template_code` (string): Mã mẫu
  - `total_amount` (integer): Tổng tiền
  - `verification_code` (string): Mã cơ quan thuế
  - `voucher_book` (object): Mã phân loại
- `charged_by_card` (integer): Số tiền khách quẹt thẻ
- `estimate_delivery_date` (string (date-time)): Ngày giao hàng dự kiến
- `order_sources` (string): Mã nguồn đơn hàng
- `charged_by_fundiin` (integer): Số tiền thanh toán qua Fundiin
- `surcharge` (integer): Phụ thu
- `is_linked_partner` (boolean): Đã liên kết đối tác
- `call_laters` (object[]): Gọi lại sau
- `last_update_status_at` (string (date-time)): Thời điểm cập nhật trạng thái cuối
- `discount_by_customer_level` (integer): Giảm giá theo cấp độ khách hàng
- `viewing` (object[]): NV đang xem
- `additional_info` (object): Thông tin bổ sung
  - `service_partner` (string): Dịch vụ vận chuyển Values: `instant` Hỏa tốc.
  - `delivery_deadline` (string (date-time)): Hạn giao hàng (ISO8601, không kèm timezone).
  - `ship_by_date` (integer): Hạn bàn giao đơn sàn Shopee/TikTok (Unix timestamp, giây) — phải bàn giao cho ĐVVC trước mốc này, quá hạn sàn có thể tự hủy đơn. Shopee lấy `ship_by_date`, TikTok lấy `collection_due_time`. `0` = sàn chưa trả; `null` với đơn không phải đơn sàn.
- `order_returned_ids` (string): Mã đơn hàng đổi trả
- `cost_surcharge` (integer): Phụ phí
- `time_send_partner` (string (date-time)): Thời điểm gửi đơn vị vận chuyển
- `charged_by_kredivo` (integer): Số tiền thanh toán qua Kredivo
- `discount` (integer): Giảm giá
- `histories` (object[]): Lịch sử
- `duplicated_customer` (boolean): Khách hàng trùng lặp
- `customer_referral_code` (object): Mã giới thiệu khách hàng
  - `active` (string): Trạng thái kích hoạt
  - `customer_id` (string (uuid)): Mã khách hàng
  - `discount` (string): Giá trị giảm giá
  - `format` (string): Định dạng mã giới thiệu
  - `free_products_priced_between_approx` (object): Miễn phí cho khách mới sản phẩm có giá
  - `is_percent` (string): Giảm giá theo phần trăm
  - `only_customers_with_level_will_have_referral_code` (string): Chỉ khách hàng có cấp độ mới có mã giới thiệu
  - `referral_code` (string): Mã giới thiệu
  - `reward_points_for_old_customers` (object): Điểm thưởng khách hàng
  - `shop_customer_id` (string (uuid)): Mã khách hàng shop
- `tax` (integer): Thuế
- `is_from_ecommerce` (boolean): Đơn hàng từ sàn thương mại điện tử
- `note_image` (string (uri)[]): Link hình ảnh ghi chú
- `shopify_draft_order_id` (string): Mã đơn hàng nháp Shopify
- `display_id` (integer): Mã hiển thị
- `shop_partner_id` (integer): Mã đối tác shop
- `is_locked` (boolean): Khóa đơn hàng
- `merge_order` (boolean): Cho phép gộp đơn

```json
{
  "is_abandoned_order": true,
  "bill_full_name": "Hoang Anh",
  "bill_phone_number": "0999999999",
  "conversation_id": "117967746266487_9306266852780716",
  "is_free_shipping": false,
  "received_at_shop": false,
  "page_id": "256469571178082",
  "account": 4,
  "account_name": "facebook321",
  "assigning_seller_id": "340644fc-314d-450e-a45f-33343678cab6",
  "items": [
    {
      "discount_each_product": 0,
      "is_bonus_product": false,
      "is_discount_percent": false,
      "is_wholesale": false,
      "one_time_product": false,
      "quantity": 1,
      "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
      "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
      "variation_info": {
        "detail": null,
        "fields": null,
        "display_id": null,
        "name": "aaaaaa",
        "product_display_id": null,
        "retail_price": 100000,
        "weight": 100
      }
    }
  ],
  "note": "",
  "note_print": null,
  "merge_order": false,
  "returned_reason": 1,
  "warehouse_id": "630744ef-4614-4a70-988c-52e6d78c953c",
  "shipping_address": {
    "address": "aaaaa",
    "commune_id": "2210941",
    "country_code": null,
    "district_id": "22109",
    "full_address": "aaaaa, Xã Bắc Lý, Huyện Hiệp Hòa, Bắc Giang",
    "full_name": "hoang anh",
    "phone_number": "0999999999",
    "post_code": null,
    "province_id": "221"
  },
  "shipping_fee": 0,
  "shop_id": 4,
  "total_discount": 0,
  "warehouse_info": {
    "district_id": "10111",
    "full_address": "kakakaka, Phường Khương Trung, Quận Thanh Xuân, Hà Nội",
    "name": "snappy",
    "phone_number": "0999999999",
    "province_id": "101"
  },
  "custom_id": "Ma0001",
  "activated_promotion_advances": [
    {
      "promotion_advance_id": "fb056b32-9cf6-4c5a-92de-0eb94db71121",
      "is_activated": true
    }
  ],
  "invoice_info_list": [
    {
      "invoice_type": "personal",
      "is_requested": true,
      "invoice_detail": {
        "name": "Hoang Anh",
        "phone_number": "0934283743",
        "identity_code": "029374382740",
        "tax_id": "",
        "email": ""
      }
    }
  ],
  "status": 0,
  "cash": 0
}
```

### Phản hồi

- `200` Success (object)

```json
{
  "id": 1418,
  "system_id": 1,
  "shop_id": 4,
  "inserted_at": "2020-05-12T04:51:42",
  "updated_at": "2020-05-12T04:51:54",
  "status": 0,
  "status_name": "new",
  "bill_full_name": "Hoang Anh",
  "bill_phone_number": "0999999999",
  "bill_email": "customer@example.com",
  "page_id": "256469571178082",
  "post_id": "185187094667903_477083092110915",
  "ad_id": "23851252560290199",
  "shipping_fee": 0,
  "cod": 0,
  "cash": 0,
  "account": 1,
  "total_discount": 0,
  "note": "",
  "note_print": null,
  "received_at_shop": false,
  "is_free_shipping": false,
  "is_locked": false,
  "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
  "creator": {
    "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
    "fb_id": "2042723249341651",
    "name": "Hoang Anh",
    "avatar_url": null
  },
  "items": [],
  "partner": {
    "partner_id": 1,
    "cod": 0,
    "extend_code": "S58824.MB25.C3.500020713",
    "total_fee": 0,
    "updated_at": "2020-05-12T05:18:16"
  },
  "shipping_address": {
    "full_name": "Hoang Anh",
    "phone_number": "0999999999",
    "address": "90 Cầu Giấy",
    "full_address": "90 Cầu Giấy, Phường Dịch Vọng, Quận Cầu Giấy, Hà Nội",
    "province_id": "101",
    "district_id": "10113",
    "commune_id": "1011309"
  }
}
```

## Lấy thông tin 1 đơn hàng

`GET /shops/{SHOP_ID}/orders/{ORDER_ID}`

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |
| `ORDER_ID` | path | string | yes | Mã đơn hàng |

### Phản hồi

- `200` Success (object)

```json
{
  "id": 1,
  "system_id": 1,
  "shop_id": 1,
  "inserted_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z",
  "status": 1,
  "status_name": "Đã xác nhận",
  "bill_full_name": "Hoang Anh",
  "bill_phone_number": "0999999999",
  "bill_email": "hoang@example.com",
  "page_id": "104438181227821",
  "post_id": "185187094667903_477083092110915",
  "ad_id": "23851252560290199",
  "shipping_fee": 1,
  "partner_fee": 1,
  "fee_marketplace": 1,
  "customer_pay_fee": true,
  "is_free_shipping": true,
  "is_livestream": true,
  "is_live_shopping": true,
  "is_smc": true,
  "received_at_shop": true,
  "total_discount": 1,
  "note": "",
  "note_print": null,
  "returned_reason": 1,
  "returned_reason_name": "Do khách hàng",
  "sub_status": 1,
  "warehouse_id": "b4cb5897-6e56-4581-96cc-2f12677c7bd8",
  "warehouse_info": {
    "name": "kho test ecod",
    "phone_number": "0999999999",
    "full_address": "hâhhha, Xã Bình Trung, Huyện Châu Đức, Bà Rịa-Vũng Tàu",
    "address": "hâhhha",
    "province_id": "717",
    "district_id": "71705",
    "commune_id": "7170510",
    "affiliate_id": null,
    "ffm_id": null,
    "has_snappy_service": true,
    "custom_id": null
  },
  "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
  "creator": {
    "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
    "fb_id": "2042723249341651",
    "name": "Hoang Anh",
    "avatar_url": null
  },
  "items": [
    {
      "id": 1,
      "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
      "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
      "quantity": 1,
      "returned_count": 1,
      "assigning_seller_id": "340644fc-314d-450e-a45f-33343678cab6",
      "quantity_by_combo_products": [],
      "discount_each_product": 1,
      "is_bonus_product": true,
      "is_discount_percent": true,
      "is_wholesale": true,
      "is_composite": true,
      "one_time_product": true,
      "note": "",
      "note_product": "",
      "inserted_at": "2024-01-01T00:00:00Z",
      "measure_group_id": 1,
      "variation_info": {
        "id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
        "name": "Ao so mi nam",
        "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
        "retail_price": 140000,
        "detail": "",
        "images": [
          "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
        ],
        "fields": [
          {
            "id": "field-id-1",
            "name": "Màu",
            "value": "Trắng",
            "keyValue": "Màu"
          }
        ],
        "barcode": "BARCODE123",
        "brand_id": null,
        "category_ids": [
          1290021044
        ],
        "display_id": "13109",
        "product_display_id": "a131092025",
        "is_upsale_product": true,
        "last_imported_price": 30000,
        "weight": 0,
        "measure_info": {
          "measure_id": 1,
          "exchange_value": 1
        },
        "avg_price": 30000
      },
      "components": [
        {
          "component_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
          "quantity": 1,
          "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7"
        }
      ]
    }
  ],
  "partner": {
    "partner_id": 1,
    "cod": 0,
    "extend_code": "S58824.MB25.C3.500020713",
    "total_fee": 0,
    "updated_at": "2020-05-12T05:18:16",
    "delivery_name": null,
    "delivery_tel": null,
    "picked_up_at": null,
    "sort_code": null,
    "paid_at": null,
    "system_created": true,
    "partner_status": "request_received",
    "partner_name": "Shopee Xpress",
    "first_delivery_at": null,
    "first_undeliverable_at": "2025-06-30T06:41:44",
    "count_of_delivery": 1,
    "order_number_vtp": null,
    "printed_form": null,
    "extend_update": [
      {
        "key": "status",
        "status": "delivered",
        "tracking_id": "S58824.MB25.C3.500020713",
        "note": "",
        "update_at": "2020-05-12T05:18:16"
      }
    ]
  },
  "shipping_address": {
    "full_name": "Hoang Anh",
    "phone_number": "0999999999",
    "address": "90 Cầu Giấy",
    "full_address": "90 Cầu Giấy, Phường Dịch Vọng, Quận Cầu Giấy, Hà Nội",
    "province_id": "101",
    "district_id": "10113",
    "commune_id": "1011309",
    "commnue_name": "Phường Dịch Vọng",
    "district_name": "Quận Cầu Giấy",
    "province_name": "Hà Nội",
    "country_code": "84",
    "post_code": null
  },
  "payment_purchase_histories": [
    {
      "amount": 1800000,
      "type": "cash",
      "inserted_at": "2024-01-01T00:00:00Z",
      "result_code": "00",
      "ipn_reply": true,
      "voucher_amount": 0,
      "tags": [
        "payment"
      ]
    }
  ],
  "tags": [
    {
      "id": 75,
      "name": "thẻ 4"
    }
  ],
  "marketer": {
    "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
    "name": "Marketer Name",
    "email": "marketer@example.com",
    "phone_number": "0999999999",
    "fb_id": "2042723249341651",
    "avatar_url": null
  },
  "pke_mkter": "cee3c05e-5f85-43c4-b27e-889b99c50097",
  "activated_combo_products": {
    "combo_product_id": 1,
    "quantity_combo_activated": 1
  },
  "activated_promotion_advances": [
    {
      "id": 1,
      "promotion_advance_id": "fb056b32-9cf6-4c5a-92de-0eb94db71121"
    }
  ],
  "tracking_link": "https://tracking.example.com",
  "payment_link": "https://payment.example.com",
  "ads_source": null,
  "shopify_order_id": null,
  "shopify_abandon_checkout_id": 1,
  "is_abandoned_order": true,
  "cod": 0,
  "cash": 0,
  "account": 1,
  "account_name": "facebook321",
  "advanced_platform_fee": {
    "ads_top_up": 1,
    "affiliate_commission": 1,
    "diff_shipping_fee": 1,
    "marketplace_voucher": 1,
    "payment_fee": 1,
    "platform_commission": 1,
    "seller_transaction_fee": 1,
    "service_fee": 1,
    "sfp_service_fee": 1
  },
  "printing_count": 1,
  "marketplace_id": "-3",
  "money_to_collect": 1,
  "total_price": 1,
  "shop_customer_address_id": "0fefd213-7d0c-4d5b-bdbf-35694da80857",
  "customer": {
    "fb_id": null,
    "id": "96a8e283-3fba-492e-a35a-970f72a30a02",
    "name": "Trần Văn Hoàng",
    "page_id": "104438181227821"
  },
  "total_quantity": 1,
  "time_assign_marketer": "2024-01-01T00:00:00Z",
  "status_history": [
    {
      "avatar_url": null,
      "editor_fb": "2042723249341651",
      "editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
      "name": "Hoang Anh",
      "old_status": 0,
      "status": 1,
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ],
  "duplicated_phone": true,
  "order_currency": "VND",
  "charged_by_vnpay": 1,
  "charged_by_qrpay": 1,
  "custom_id": null,
  "last_editor": {
    "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
    "fb_id": "2042723249341651",
    "name": "Hoang Anh",
    "email": "hoang@example.com",
    "avatar_url": null,
    "phone_number": "0999999999"
  },
  "last_editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
  "charged_by_momo": 1,
  "bank_transfer_images": [
    "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
  ],
  "transfer_money": 1,
  "transfer_proofs": [
    {
      "id": 1,
      "order_id": 1,
      "shop_id": 1,
      "payment_id": "64e130e4-012a-45b1-bd88-51811f23ead8",
      "amount": 1,
      "images": [
        "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
      ],
      "note": null,
      "is_income": true,
      "is_verify": true,
      "verify_at": "2024-01-01T00:00:00Z",
      "verifier": {
        "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "fb_id": "2042723249341651",
        "name": "Hoang Anh",
        "avatar_url": null
      },
      "creator": {
        "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "fb_id": "2042723249341651",
        "name": "Hoang Anh",
        "avatar_url": null
      },
      "last_editor": {
        "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "fb_id": "2042723249341651",
        "name": "Hoang Anh",
        "avatar_url": null
      },
      "order_info": null,
      "inserted_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ],
  "lock_order_by_user": null,
  "assigning_care": {
    "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
    "fb_id": "2042723249341651",
    "name": "Care Name",
    "email": "care@example.com",
    "avatar_url": null,
    "phone_number": "0999999999"
  },
  "assigning_care_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
  "time_assign_care": "2024-01-01T00:00:00Z",
  "assigning_seller": {
    "id": "340644fc-314d-450e-a45f-33343678cab6",
    "fb_id": "2042723249341651",
    "name": "Seller Name",
    "email": "seller@example.com",
    "avatar_url": null,
    "phone_number": "0999999999"
  },
  "einvoices": [],
  "charged_by_card": 1,
  "estimate_delivery_date": "2024-01-01T00:00:00Z",
  "order_sources": "-1",
  "charged_by_fundiin": 1,
  "surcharge": 1,
  "is_linked_partner": true,
  "call_laters": [],
  "last_update_status_at": "2024-01-01T00:00:00Z",
  "discount_by_customer_level": 1,
  "viewing": [],
  "order_returned_ids": null,
  "cost_surcharge": 1,
  "time_send_partner": "2024-01-01T00:00:00Z",
  "charged_by_kredivo": 1,
  "discount": 1,
  "histories": [],
  "duplicated_customer": true,
  "tax": 1,
  "is_from_ecommerce": true,
  "note_image": [
    "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
  ],
  "shopify_draft_order_id": null,
  "display_id": 1,
  "shop_partner_id": 1,
  "is_locked": true,
  "additional_info": {
    "service_partner": "instant"
  },
  "invoice_info_list": [
    {
      "error": "",
      "invoice_detail": {
        "company_address": "85 lê quý đôn, phường nam định, tỉnh Ninh Bình",
        "company_address_breakdown": {
          "company_additional_info": "",
          "company_barangay": "",
          "company_city": "",
          "company_detailed_address": "85 lê quý đôn, phường nam định, tỉnh Ninh Bình",
          "company_district": "Phường Nam Định",
          "company_full_address": "85 lê quý đôn, phường nam định, tỉnh Ninh Bình",
          "company_postcode": "",
          "company_province": "",
          "company_region": "VietNam",
          "company_state": "Ninh Bình",
          "company_town": "Phường Nam Định",
          "company_email": "acb@gmail.com",
          "company_name": "Công ty cổ phần tư vấn xây dựng điện Hoàng Phát",
          "company_tax_id": "0601043840"
        }
      },
      "invoice_type": "company",
      "is_requested": true,
      "order_sn": "251121BVGU6RVE"
    }
  ],
  "reports_by_phone": {
    "+639175706297": {
      "order_fail": 29,
      "order_success": 20,
      "warning": 0
    }
  },
  "p_utm_source": "fb",
  "p_utm_medium": "paid",
  "p_utm_campaign": "120236828168640593",
  "p_utm_term": "120236828168790593",
  "p_utm_content": "120236828168960593",
  "link": "https://www.myfahathai.com/doc?fbclid=IwZXh0bgNhZW0BMABhZGlkAasqwhnoX"
}
```

## Cập nhật đơn hàng

`PUT /shops/{SHOP_ID}/orders/{ORDER_ID}`

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |
| `ORDER_ID` | path | string | yes | Mã đơn hàng |

### Nội dung yêu cầu

Thông tin đơn hàng cần cập nhật

- `id` (integer): Mã đơn hàng
- `system_id` (integer): Mã hệ thống
- `shop_id` (integer): Mã cửa hàng
- `inserted_at` (string (date-time)): Thời điểm tạo đơn
- `updated_at` (string (date-time)): Thời điểm cập nhật đơn
- `status` (integer): Trạng thái đơn hàng Values: `0` Mới, `17` Chờ xác nhận, `11` Chờ hàng, `12` Chờ in, `13` Đã in, `20` Đã đặt hàng, `1` Đã xác nhận, `8` Đang đóng hàng, `9` Chờ chuyển hàng, `2` Đã gửi hàng, `3` Đã nhận, `16` Đã thu tiền, `4` Đang hoàn, `15` Hoàn một phần, `5` Đã hoàn, `6` Đã hủy, `7` Đã xóa.
- `status_name` (string): Tên trạng thái đơn hàng
- `bill_full_name` (string): Tên khách hàng
- `bill_phone_number` (string): SĐT khách hàng
- `bill_email` (string): Email khách hàng
- `conversation_id` (string): Mã hội thoại
- `page_id` (string): Mã Facebook page
- `post_id` (string): Mã bài viết
- `ad_id` (string): Mã quảng cáo
- `shipping_fee` (integer): Phí vận chuyển
- `partner_fee` (integer): Phí vận chuyển từ ĐVVC
- `fee_marketplace` (integer): Phí sàn
- `customer_pay_fee` (boolean): Khách trả phí ship
- `is_free_shipping` (boolean): Miễn phí vận chuyển
- `is_livestream` (boolean): Đơn hàng từ livestream
- `is_live_shopping` (boolean): Đơn hàng từ live shopping
- `is_smc` (boolean): Đơn hàng từ mua sắm trên Messenger
- `received_at_shop` (boolean): true: Bán tại quầy, false: Bán online
- `total_discount` (integer): Tổng tiền giảm giá
- `note` (string): Ghi chú nội bộ
- `note_print` (string): Ghi chú đơn hàng
- `returned_reason` (integer): Mã lý do hoàn hàng (1: Do khách hàng, 2: Do nhân viên, 3: Do sản phẩm lỗi, 4: Do đơn vị vận chuyển, 5: Do đổi hàng). Mã khác là lý do tùy chỉnh theo từng shop, xem tên hiển thị tại returned_reason_name
- `returned_reason_name` (string): Tên lý do hoàn hàng
- `sub_status` (integer): Lý do delay giao hàng
- `warehouse_id` (string): Mã kho hàng
- `warehouse_info` (object): Thông tin kho hàng
  - `name` (string): Tên kho hàng
  - `phone_number` (string): Số điện thoại kho hàng
  - `full_address` (string): Địa chỉ đầy đủ kho hàng
  - `address` (string): Địa chỉ chi tiết kho hàng
  - `province_id` (string): Mã tỉnh thành phố
  - `district_id` (string): Mã quận huyện
  - `commune_id` (string): Mã phường xã
  - `affiliate_id` (string): Mã đại lý
  - `ffm_id` (string): Mã FFM
  - `has_snappy_service` (boolean): Có dịch vụ Snappy
  - `custom_id` (string): Mã tùy chỉnh
- `creator_id` (string): Mã người tạo
- `creator` (object): Thông tin người tạo đơn
  - `id` (string): Mã người tạo
  - `fb_id` (string): ID facebook người tạo đơn
  - `name` (string): Tên người tạo đơn
  - `avatar_url` (string): Link avatar người tạo
- `items` (object[]): Danh sách sản phẩm
  - `product_id` (string): Mã sản phẩm
  - `quantity` (integer, required): Số lượng
  - `returned_count` (integer): Số lượng đã trả
  - `assigning_seller_id` (string): Mã nhân viên được phân công
  - `quantity_by_combo_products` (object[]): Số lượng theo combo sản phẩm
  - `discount_each_product` (integer): Giảm giá cho từng sản phẩm
  - `is_bonus_product` (boolean): Sản phẩm tặng kèm
  - `is_discount_percent` (boolean): Giảm giá theo phần trăm
  - `is_wholesale` (boolean): Bán sỉ
  - `is_composite` (boolean): Sản phẩm composite
  - `one_time_product` (boolean): Sản phẩm một lần
  - `note` (string): Ghi chú sản phẩm
  - `note_product` (string): Ghi chú sản phẩm
  - `inserted_at` (string (date-time)): Thời điểm tạo
  - `measure_group_id` (integer): Mã nhóm đơn vị tính
  - `variation_info` (object): Thông tin biến thể. Không bắt buộc khi tạo/cập nhật đơn (backend tự coi là object rỗng nếu thiếu). Các field bên trong không bắt buộc riêng lẻ, nhưng nên gửi `retail_price` để giá dòng hàng đúng.
  - `components` (object[]): Thành phần sản phẩm
  - `variation_id` (string, required): Mã biến thể
- `partner` (object): Thông tin đơn vị vận chuyển Khi cập nhật đơn đã có thông tin vận chuyển, chỉ field được gửi mới được ghi; field không gửi giữ nguyên giá trị hiện tại. Gửi `null` để xoá `partner_id`, `extend_code` hoặc `shop_partner_id`.
  - `partner_id` (integer): ID đơn vị vận chuyển trên hệ thống Pancake
  - `cod` (integer): Đối soát tiền thu hộ
  - `extend_code` (string): Mã vận đơn
  - `total_fee` (integer): Tổng phí
  - `updated_at` (string (date-time)): Thời điểm cập nhật
  - `delivery_name` (string): Tên người giao hàng
  - `delivery_tel` (string): Số điện thoại người giao hàng
  - `picked_up_at` (string (date-time)): Thời điểm lấy hàng
  - `sort_code` (string): Mã phân loại
  - `paid_at` (string (date-time)): Thời điểm thanh toán
  - `system_created` (boolean): Được tạo bởi hệ thống
  - `extend_update` (object[]): Cập nhật từ đơn vị vận chuyển
  - `partner_status` (string): Trạng thái vận chuyển Values: `waiting` Chờ xử lý, `request_received` ĐVVC đã tiếp nhận đơn, `processing_picked_up` Đang xử lý lấy hàng, `picking_up` Đang lấy hàng, `delay_pickup` Trễ lấy hàng, `picked_up` Đã lấy hàng, `waiting_on_the_way` Chờ trung chuyển, `on_the_way` Đang trung chuyển, `contact_delivery_company` Liên hệ ĐVVC, `out_for_delivery` Đang giao hàng, `delay_delivery` Trễ giao hàng, `inform_recipient` Thông báo cho người nhận, `undeliverable` Giao không thành, `waiting_for_return` Chờ chuyển hoàn, `delivered` Đã giao hàng, `delivered_cod` Đã giao hàng, đã đối soát COD, `returning` Đang chuyển hoàn, `returned` Đã chuyển hoàn, `returned_cod` Đã chuyển hoàn, đã đối soát COD, `canceled` Đã hủy vận đơn.
  - `partner_name` (string): Tên đơn vị vận chuyển
  - `first_delivery_at` (string (date-time)): Thời điểm giao hàng lần đầu
  - `first_undeliverable_at` (string (date-time)): Thời điểm giao hàng thất bại lần đầu
  - `count_of_delivery` (integer): Số lần đi giao. Cập nhật từ đơn vị vận chuyển tự cộng 1 mỗi lần vận đơn chuyển sang `out_for_delivery` hoặc `delay_delivery`. Có thể ghi khi tạo hoặc cập nhật đơn (số nguyên 0-32767); bỏ qua hoặc giá trị không hợp lệ thì giữ giá trị hiện tại, các lần cập nhật sau từ đơn vị vận chuyển tiếp tục đếm từ giá trị đã ghi.
  - `order_number_vtp` (string): Mã vận đơn Viettel Post
  - `printed_form` (object): Mẫu in
- `shipping_address` (ShippingAddress): 
  - `address` (string): Địa chỉ. Khi tạo đơn qua API, nếu có `address` nhưng `province_id` để trống, hệ thống sẽ tự động phân tích địa chỉ dạng văn bản này để điền `province_id`, `district_id` và `commune_id`. Bỏ qua tự động điền nếu địa chỉ thuộc Thái Lan (mã quốc gia 66) hoặc không xác định được phường/xã từ nội dung.
  - `commnue_name` (string): Tên phường/xã
  - `commune_id` (string): Mã phường/xã
  - `country_code` (string): Mã quốc gia
  - `district_id` (string): Mã quận/huyện
  - `district_name` (string): Tên quận/huyện
  - `full_address` (string): Địa chỉ đầy đủ
  - `full_name` (string): Họ và tên
  - `new_full_address` (string): Địa chỉ đầy đủ mới
  - `new_province_id` (string): Mã tỉnh/thành mới
  - `phone_number` (string): Số điện thoại
  - `post_code` (string): Mã bưu điện
  - `province_id` (string): Mã tỉnh/thành
  - `province_name` (string): Tên tỉnh/thành
  - `render_type` (string): Loại hiển thị
- `payment_purchase_histories` (object[]): Lịch sử thanh toán
  - `amount` (integer): Số tiền
  - `type` (string): Loại thanh toán
  - `inserted_at` (string (date-time)): Thời điểm giao dịch
  - `result_code` (string): Mã kết quả
  - `ipn_reply` (boolean): Phản hồi IPN
  - `voucher_amount` (integer): Số tiền voucher
  - `tags` (string[]): Thẻ
- `tags` (object[]): Danh sách thẻ đơn hàng
  - `id` (integer): Mã thẻ đơn hàng
  - `name` (string): Tên thẻ đơn hàng
- `marketer` (object): Thông tin marketer
  - `id` (string): Mã marketer
  - `name` (string): Tên marketer
  - `email` (string): Email marketer
  - `phone_number` (string): Số điện thoại marketer
  - `fb_id` (string): Facebook ID marketer
  - `avatar_url` (string): Link avatar marketer
- `pke_mkter` (string): Mã nhân viên marketer
- `activated_combo_products` (object): Thông tin combo sản phẩm được kích hoạt
  - `combo_product_id` (integer): Mã combo sản phẩm
  - `quantity_combo_activated` (integer): Số lượng combo được kích hoạt
  - `combo_product_info` (object): Thông tin combo sản phẩm
- `activated_promotion_advances` (object[]): Thông tin khuyến mãi được kích hoạt
  - `id` (integer): Mã
  - `promotion_advance_id` (string): Mã khuyến mãi
  - `promotion_advance_info` (object): Thông tin khuyến mãi
- `invoice_info_list` (object[]): Danh sách thông tin hóa đơn
  - `error` (string): Thông báo lỗi nếu có
  - `invoice_detail` (object): Chi tiết thông tin hóa đơn. Các trường cần truyền phụ thuộc vào `invoice_type`: - `company` (tổ chức): dùng `company_name`, `company_tax_id`, `company_address`, `company_email` (và `company_address_breakdown` nếu có). - `personal` (cá nhân): dùng `name`, `phone_number`, `identity_code`, `tax_id`, `email`.
  - `invoice_type` (string): Loại hóa đơn: `company` xuất cho tổ chức/công ty, `personal` xuất cho cá nhân. Quyết định các trường trong `invoice_detail` được sử dụng. Values: `company`, `personal`.
  - `is_requested` (boolean): Khách yêu cầu xuất hóa đơn điện tử cho đơn này. Truyền `true` cùng `invoice_type` và `invoice_detail` để yêu cầu xuất hóa đơn.
  - `order_sn` (string): Mã đơn hàng trên sàn
- `reports_by_phone` (object): Báo cáo theo số điện thoại
  - `order_fail` (integer): Số đơn thất bại
  - `order_success` (integer): Số đơn thành công
  - `warning` (integer): Số đơn cảnh báo
- `tracking_link` (string): Link xác nhận đơn hàng
- `payment_link` (string): Link thanh toán
- `ads_source` (string): Nguồn quảng cáo
- `bank_payments` (object): Phương thức thanh toán
- `transfer_proofs` (object[]): Danh sách chứng từ xác thực chuyển khoản, gồm ngày giờ xác thực, số tiền và ảnh chứng từ
  - `id` (integer): Mã chứng từ chuyển khoản
  - `order_id` (integer): Mã đơn hàng
  - `shop_id` (integer): Mã cửa hàng
  - `payment_id` (string): Mã phương thức thanh toán ngân hàng (trùng với key trong `bank_payments`)
  - `amount` (integer): Số tiền chuyển khoản
  - `images` (string[]): Danh sách ảnh chứng từ chuyển khoản
  - `note` (string): Ghi chú
  - `is_income` (boolean): Là khoản tiền nhận vào (true) hay chi ra (false)
  - `is_verify` (boolean): Chứng từ đã được xác thực hay chưa
  - `verify_at` (string (date-time)): Thời điểm xác thực chuyển khoản
  - `verifier` (object): Thông tin người xác thực
  - `creator` (object): Thông tin người tạo chứng từ
  - `last_editor` (object): Thông tin người chỉnh sửa cuối
  - `order_info` (object): Thông tin đơn hàng bổ sung
  - `inserted_at` (string (date-time)): Thời điểm tạo chứng từ
  - `updated_at` (string (date-time)): Thời điểm cập nhật chứng từ
- `shopify_order_id` (string): Mã đơn hàng Shopify
- `shopify_abandon_checkout_id` (integer): Mã Shopify abandon checkout
- `is_abandoned_order` (boolean): Cờ đơn chưa hoàn tất khi tạo hoặc cập nhật đơn. Truyền trực tiếp trong body, không bọc trong `third_party` hoặc `third_party_infomation`. Giá trị truyền lên, kể cả `false`, được ưu tiên hơn kết quả nhận diện tự động. Nếu bỏ qua khi tạo đơn, cờ được xác định tự động; nếu bỏ qua khi cập nhật, giữ nguyên giá trị hiện tại. Chỉ boolean `true` hoặc chuỗi `"true"` được chuẩn hóa thành `true`; mọi giá trị khác được gửi lên đều thành `false`.
- `cod` (integer): Tiền thu hộ
- `cash` (integer): Tiền mặt
- `account` (integer): Mã nguồn đơn hàng
- `account_name` (string): Tên mã nguồn đơn
- `advanced_platform_fee` (object): Phí từ sàn thương mại điện tử
  - `ads_top_up` (integer): Ví quảng cáo
  - `affiliate_commission` (integer): Phí hoa hồng (Sàn TMĐT)
  - `diff_shipping_fee` (integer): Chênh lệch phí vận chuyển (Sàn TMĐT)
  - `marketplace_voucher` (integer): Sàn trợ giá
  - `payment_fee` (integer): Phí cố định, giao dịch (Sàn TMĐT)
  - `platform_commission` (integer): Phí hoa hồng nền tảng (Sàn TMĐT)
  - `seller_transaction_fee` (integer): Phí thanh toán (Sàn TMĐT)
  - `service_fee` (integer): Phí dịch vụ (Sàn TMĐT)
  - `sfp_service_fee` (integer): Phí dịch vụ SFP (Sàn TMĐT)
- `printing_count` (integer): Số lần in
- `money_to_collect` (integer): Số tiền cần thu
- `marketplace_id` (string): Mã sàn thương mại điện tử Values: `-2`, `-3`, `-4`, `-9`, `-16`, `-17`, `-20`, `-25`, `-27`, `-28`.
- `total_price` (integer): Tổng giá trị sản phẩm
- `shop_customer_address_id` (string): Mã địa chỉ khách hàng
- `customer` (object): Thông tin khách hàng
  - `fb_id` (string): Facebook ID khách hàng
  - `id` (string): Mã khách hàng
  - `name` (string): Tên khách hàng
  - `page_id` (string): Mã trang
- `total_quantity` (integer): Tổng số lượng
- `time_assign_marketer` (string (date-time)): Thời điểm phân công marketer
- `p_utm_source` (string): UTM Source
- `p_utm_medium` (string): UTM Medium
- `p_utm_campaign` (string): UTM Campaign
- `p_utm_term` (string): UTM Term
- `p_utm_content` (string): UTM Content
- `p_utm_id` (string): UTM ID
- `utm_affiliate` (string): Affiliate
- `link` (string): Link
- `status_history` (object[]): Lịch sử cập nhật trạng thái
  - `avatar_url` (string): Link avatar
  - `editor` (object): Thông tin người chỉnh sửa
  - `editor_fb` (string): Facebook ID người chỉnh sửa
  - `editor_id` (string): Mã người chỉnh sửa
  - `name` (string): Tên
  - `old_status` (integer): Trạng thái cũ
  - `status` (integer): Trạng thái
  - `updated_at` (string (date-time)): Thời điểm cập nhật
- `duplicated_phone` (boolean): Số điện thoại trùng lặp
- `order_currency` (string): Loại tiền tệ
- `charged_by_vnpay` (integer): Số tiền thanh toán qua VNPay
- `charged_by_qrpay` (integer): Số tiền khách thanh toán qua QRPAY
- `custom_id` (string): Mã tùy chỉnh
- `last_editor` (object): Thông tin người chỉnh sửa cuối cùng đơn hàng
  - `id` (string): Mã người chỉnh sửa
  - `fb_id` (string): Facebook ID người chỉnh sửa
  - `name` (string): Tên người chỉnh sửa
  - `email` (string): Email người chỉnh sửa
  - `avatar_url` (string): Link avatar người chỉnh sửa
  - `phone_number` (string): Số điện thoại người chỉnh sửa
- `last_editor_id` (string): Mã người sửa cuối
- `charged_by_momo` (integer): Số tiền khách thanh toán qua MOMO
- `prepaid_by_point` (object): Thanh toán bằng điểm thưởng
  - `money` (integer): Số tiền
  - `point` (integer): Số điểm
- `bank_transfer_images` (string (uri)[]): Hình ảnh chuyển khoản
- `transfer_money` (integer): Số tiền khách chuyển khoản
- `lock_order_by_user` (string): Mã người dùng khóa đơn hàng
- `assigning_care` (object): Nhân viên chăm sóc
  - `id` (string): Mã người chăm sóc
  - `fb_id` (string): Facebook ID người chăm sóc
  - `name` (string): Tên người chăm sóc
  - `email` (string): Email người chăm sóc
  - `avatar_url` (string): Link avatar người chăm sóc
  - `phone_number` (string): Số điện thoại người chăm sóc
- `assigning_care_id` (string): Mã nhân viên chăm sóc
- `time_assign_care` (string (date-time)): Thời điểm phân công chăm sóc
- `assigning_seller` (object): Nhân viên được phân công
  - `id` (string): Mã người bán
  - `fb_id` (string): Facebook ID người bán
  - `name` (string): Tên người bán
  - `email` (string): Email người bán
  - `avatar_url` (string): Link avatar người bán
  - `phone_number` (string): Số điện thoại người bán
- `einvoices` (EInvoice[]): 
  - `actual_shipping_fee` (integer): Phí vận chuyển
  - `adjust_amount` (integer): Phần trăm giảm trên doanh thu
  - `adjustment_criteria` (integer): Tiêu chí điều chỉnh Values: `1` Điều chỉnh số lượng, `2` Điều chỉnh đơn giá, `3` Điều chỉnh thuế suất, `4` Điều chỉnh tiền thuế.
  - `adjustment_type` (integer): Loại điều chỉnh Values: `1` Điều chỉnh tăng, `2` Điều chỉnh giảm, `3` Thông tin.
  - `allocation_discounts` (object[]): Phân bổ chiết khấu
  - `allocation_type` (integer): Loại phân bổ Values: `1` Theo đơn giá, `2` Tùy chỉnh.
  - `bank_account_number` (string): Số tài khoản ngân hàng
  - `bank_name` (string): Tên ngân hàng
  - `budget_unit_code` (string): Mã đơn vị ngân sách
  - `buyer_not_get_invoice` (boolean): Người mua không nhận hóa đơn
  - `creator` (object): Thông tin người tạo
  - `discount` (integer): Giảm giá chung
  - `display_id` (integer): Mã hiển thị
  - `einvoice_account_id` (integer): Mã tài khoản hóa đơn điện tử
  - `email` (string): Địa chỉ email
  - `full_name` (string): Tên người mua hàng
  - `id` (integer): ID hóa đơn
  - `identity_code` (string): Mã định danh người mua
  - `included_tax` (integer): Thuế đã bao gồm
  - `invoice_no` (string): Số hóa đơn
  - `invoice_series` (string): Ký hiệu hóa đơn
  - `invoice_type` (integer): Loại hóa đơn
  - `is_adjust_amount` (boolean): Có điều chỉnh số tiền
  - `is_included_tax` (boolean): Có bao gồm thuế
  - `items` (object[]): Danh sách sản phẩm hóa đơn
  - `key_search` (string): Mã tìm kiếm
  - `last_editor_id` (string): Mã người chỉnh sửa cuối
  - `note` (string): Ghi chú
  - `order_id` (integer): Mã đơn hàng
  - `order_info` (object): Thông tin đơn hàng
  - `original_einvoice` (object): Mã hóa đơn điện tử gốc
  - `payment_method` (string): Phương thức thanh toán
  - `phone_number` (string): Số điện thoại
  - `purchaser_tax_code` (string): Mã số thuế người mua
  - `purchaser_unit` (string): Đơn vị tính
  - `release_date` (string (date-time)): Ngày phát hành
  - `release_type` (integer): Loại phát hành
  - `shipping_address` (ShippingAddress): 
  - `shipping_fee` (integer): Phí vận chuyển
  - `shop_id` (integer): Mã shop
  - `signature_type` (integer): Loại chữ ký
  - `status` (integer): Trạng thái Values: `0` Chưa phát hành, `1` Chờ phát hành, `2` Đã phát hành, `3` Đã hủy, `4` Hoá đơn thay thế, `5` Hoá đơn bị thay thế, `6` Hoá đơn điều chỉnh, `7` Bị điều chỉnh.
  - `tax` (integer): Thuế suất
  - `template_code` (string): Mã mẫu
  - `total_amount` (integer): Tổng tiền
  - `verification_code` (string): Mã cơ quan thuế
  - `voucher_book` (object): Mã phân loại
- `charged_by_card` (integer): Số tiền khách quẹt thẻ
- `estimate_delivery_date` (string (date-time)): Ngày giao hàng dự kiến
- `order_sources` (string): Mã nguồn đơn hàng
- `charged_by_fundiin` (integer): Số tiền thanh toán qua Fundiin
- `surcharge` (integer): Phụ thu
- `is_linked_partner` (boolean): Đã liên kết đối tác
- `call_laters` (object[]): Gọi lại sau
- `last_update_status_at` (string (date-time)): Thời điểm cập nhật trạng thái cuối
- `discount_by_customer_level` (integer): Giảm giá theo cấp độ khách hàng
- `viewing` (object[]): NV đang xem
- `additional_info` (object): Thông tin bổ sung
  - `service_partner` (string): Dịch vụ vận chuyển Values: `instant` Hỏa tốc.
  - `delivery_deadline` (string (date-time)): Hạn giao hàng (ISO8601, không kèm timezone).
  - `ship_by_date` (integer): Hạn bàn giao đơn sàn Shopee/TikTok (Unix timestamp, giây) — phải bàn giao cho ĐVVC trước mốc này, quá hạn sàn có thể tự hủy đơn. Shopee lấy `ship_by_date`, TikTok lấy `collection_due_time`. `0` = sàn chưa trả; `null` với đơn không phải đơn sàn.
- `order_returned_ids` (string): Mã đơn hàng đổi trả
- `cost_surcharge` (integer): Phụ phí
- `time_send_partner` (string (date-time)): Thời điểm gửi đơn vị vận chuyển
- `charged_by_kredivo` (integer): Số tiền thanh toán qua Kredivo
- `discount` (integer): Giảm giá
- `histories` (object[]): Lịch sử
- `duplicated_customer` (boolean): Khách hàng trùng lặp
- `customer_referral_code` (object): Mã giới thiệu khách hàng
  - `active` (string): Trạng thái kích hoạt
  - `customer_id` (string (uuid)): Mã khách hàng
  - `discount` (string): Giá trị giảm giá
  - `format` (string): Định dạng mã giới thiệu
  - `free_products_priced_between_approx` (object): Miễn phí cho khách mới sản phẩm có giá
  - `is_percent` (string): Giảm giá theo phần trăm
  - `only_customers_with_level_will_have_referral_code` (string): Chỉ khách hàng có cấp độ mới có mã giới thiệu
  - `referral_code` (string): Mã giới thiệu
  - `reward_points_for_old_customers` (object): Điểm thưởng khách hàng
  - `shop_customer_id` (string (uuid)): Mã khách hàng shop
- `tax` (integer): Thuế
- `is_from_ecommerce` (boolean): Đơn hàng từ sàn thương mại điện tử
- `note_image` (string (uri)[]): Link hình ảnh ghi chú
- `shopify_draft_order_id` (string): Mã đơn hàng nháp Shopify
- `display_id` (integer): Mã hiển thị
- `shop_partner_id` (integer): Mã đối tác shop
- `is_locked` (boolean): Khóa đơn hàng
- `merge_order` (boolean): Cho phép gộp đơn

```json
{
  "is_abandoned_order": true,
  "bill_full_name": "Hoang Anh",
  "bill_phone_number": "0999999999",
  "partner": {
    "partner_id": 1,
    "extend_code": "S58824.MB25.C3.500020713",
    "count_of_delivery": 2
  },
  "is_free_shipping": false,
  "received_at_shop": false,
  "page_id": "256469571178082",
  "account": 4,
  "account_name": "facebook321",
  "assigning_seller_id": "340644fc-314d-450e-a45f-33343678cab6",
  "items": [
    {
      "discount_each_product": 0,
      "is_bonus_product": false,
      "is_discount_percent": false,
      "is_wholesale": false,
      "one_time_product": false,
      "quantity": 1,
      "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
      "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
      "variation_info": {
        "detail": null,
        "fields": null,
        "display_id": null,
        "name": "aaaaaa",
        "product_display_id": null,
        "is_upsale_product": true,
        "retail_price": 100000,
        "weight": 100
      }
    }
  ],
  "note": "",
  "note_print": null,
  "returned_reason": 1,
  "warehouse_id": "630744ef-4614-4a70-988c-52e6d78c953c",
  "shipping_address": {
    "address": "aaaaa",
    "commune_id": "2210941",
    "country_code": null,
    "district_id": "22109",
    "full_address": "aaaaa, Xã Bắc Lý, Huyện Hiệp Hòa, Bắc Giang",
    "full_name": "hoang anh",
    "phone_number": "0999999999",
    "post_code": null,
    "province_id": "221"
  },
  "shipping_fee": 0,
  "shop_id": 4,
  "total_discount": 0,
  "warehouse_info": {
    "district_id": "10111",
    "full_address": "kakakaka, Phường Khương Trung, Quận Thanh Xuân, Hà Nội",
    "name": "snappy",
    "phone_number": "0999999999",
    "province_id": "101"
  },
  "custom_id": "Ma0001",
  "activated_promotion_advances": [
    {
      "promotion_advance_id": "fb056b32-9cf6-4c5a-92de-0eb94db71121",
      "is_activated": true
    }
  ],
  "invoice_info_list": [
    {
      "invoice_type": "personal",
      "is_requested": true,
      "invoice_detail": {
        "name": "Hoang Anh",
        "phone_number": "0934283743",
        "identity_code": "029374382740",
        "tax_id": "",
        "email": ""
      }
    }
  ],
  "status": 0,
  "cash": 0
}
```

### Phản hồi

- `200` Success (object)

```json
{
  "id": 1,
  "system_id": 1,
  "shop_id": 1,
  "inserted_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z",
  "status": 1,
  "status_name": "Đã xác nhận",
  "bill_full_name": "Hoang Anh",
  "bill_phone_number": "0999999999",
  "bill_email": "hoang@example.com",
  "page_id": "104438181227821",
  "post_id": "185187094667903_477083092110915",
  "ad_id": "23851252560290199",
  "shipping_fee": 1,
  "partner_fee": 1,
  "fee_marketplace": 1,
  "customer_pay_fee": true,
  "is_free_shipping": true,
  "is_livestream": true,
  "is_live_shopping": true,
  "is_smc": true,
  "received_at_shop": true,
  "total_discount": 1,
  "note": "",
  "note_print": null,
  "returned_reason": 1,
  "returned_reason_name": "Do khách hàng",
  "sub_status": 1,
  "warehouse_id": "b4cb5897-6e56-4581-96cc-2f12677c7bd8",
  "warehouse_info": {
    "name": "kho test ecod",
    "phone_number": "0999999999",
    "full_address": "hâhhha, Xã Bình Trung, Huyện Châu Đức, Bà Rịa-Vũng Tàu",
    "address": "hâhhha",
    "province_id": "717",
    "district_id": "71705",
    "commune_id": "7170510",
    "affiliate_id": null,
    "ffm_id": null,
    "has_snappy_service": true,
    "custom_id": null
  },
  "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
  "creator": {
    "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
    "fb_id": "2042723249341651",
    "name": "Hoang Anh",
    "avatar_url": null
  },
  "items": [
    {
      "id": 1,
      "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
      "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
      "quantity": 1,
      "returned_count": 1,
      "assigning_seller_id": "340644fc-314d-450e-a45f-33343678cab6",
      "quantity_by_combo_products": [],
      "discount_each_product": 1,
      "is_bonus_product": true,
      "is_discount_percent": true,
      "is_wholesale": true,
      "is_composite": true,
      "one_time_product": true,
      "note": "",
      "note_product": "",
      "inserted_at": "2024-01-01T00:00:00Z",
      "measure_group_id": 1,
      "variation_info": {
        "id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
        "name": "Ao so mi nam",
        "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
        "retail_price": 140000,
        "detail": "",
        "images": [
          "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
        ],
        "fields": [
          {
            "id": "field-id-1",
            "name": "Màu",
            "value": "Trắng",
            "keyValue": "Màu"
          }
        ],
        "barcode": "BARCODE123",
        "brand_id": null,
        "category_ids": [
          1290021044
        ],
        "display_id": "13109",
        "product_display_id": "a131092025",
        "is_upsale_product": true,
        "last_imported_price": 30000,
        "weight": 0,
        "measure_info": {
          "measure_id": 1,
          "exchange_value": 1
        },
        "avg_price": 30000
      },
      "components": [
        {
          "component_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
          "quantity": 1,
          "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7"
        }
      ]
    }
  ],
  "partner": {
    "partner_id": 1,
    "cod": 0,
    "extend_code": "S58824.MB25.C3.500020713",
    "total_fee": 0,
    "updated_at": "2020-05-12T05:18:16",
    "delivery_name": null,
    "delivery_tel": null,
    "picked_up_at": null,
    "sort_code": null,
    "paid_at": null,
    "system_created": true,
    "extend_update": [
      {
        "key": "status",
        "status": "delivered",
        "tracking_id": "S58824.MB25.C3.500020713",
        "note": "",
        "update_at": "2020-05-12T05:18:16"
      }
    ]
  },
  "shipping_address": {
    "full_name": "Hoang Anh",
    "phone_number": "0999999999",
    "address": "90 Cầu Giấy",
    "full_address": "90 Cầu Giấy, Phường Dịch Vọng, Quận Cầu Giấy, Hà Nội",
    "province_id": "101",
    "district_id": "10113",
    "commune_id": "1011309",
    "commnue_name": "Phường Dịch Vọng",
    "district_name": "Quận Cầu Giấy",
    "province_name": "Hà Nội",
    "country_code": "84",
    "post_code": null
  },
  "payment_purchase_histories": [
    {
      "amount": 1800000,
      "type": "cash",
      "inserted_at": "2024-01-01T00:00:00Z",
      "result_code": "00",
      "ipn_reply": true,
      "voucher_amount": 0,
      "tags": [
        "payment"
      ]
    }
  ],
  "tags": [
    {
      "id": 75,
      "name": "thẻ 4"
    }
  ],
  "marketer": {
    "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
    "name": "Marketer Name",
    "email": "marketer@example.com",
    "phone_number": "0999999999",
    "fb_id": "2042723249341651",
    "avatar_url": null
  },
  "pke_mkter": "cee3c05e-5f85-43c4-b27e-889b99c50097",
  "activated_combo_products": {
    "combo_product_id": 1,
    "quantity_combo_activated": 1
  },
  "activated_promotion_advances": [
    {
      "id": 1,
      "promotion_advance_id": "fb056b32-9cf6-4c5a-92de-0eb94db71121"
    }
  ],
  "tracking_link": "https://tracking.example.com",
  "payment_link": "https://payment.example.com",
  "ads_source": null,
  "shopify_order_id": null,
  "shopify_abandon_checkout_id": 1,
  "is_abandoned_order": true,
  "cod": 0,
  "cash": 0,
  "account": 1,
  "account_name": "facebook321",
  "advanced_platform_fee": {
    "ads_top_up": 1,
    "affiliate_commission": 1,
    "diff_shipping_fee": 1,
    "marketplace_voucher": 1,
    "payment_fee": 1,
    "platform_commission": 1,
    "seller_transaction_fee": 1,
    "service_fee": 1,
    "sfp_service_fee": 1
  },
  "printing_count": 1,
  "money_to_collect": 1,
  "total_price": 1,
  "shop_customer_address_id": "0fefd213-7d0c-4d5b-bdbf-35694da80857",
  "customer": {
    "fb_id": null,
    "id": "96a8e283-3fba-492e-a35a-970f72a30a02",
    "name": "Trần Văn Hoàng",
    "page_id": "104438181227821"
  },
  "total_quantity": 1,
  "time_assign_marketer": "2024-01-01T00:00:00Z",
  "status_history": [
    {
      "avatar_url": null,
      "editor_fb": "2042723249341651",
      "editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
      "name": "Hoang Anh",
      "old_status": 0,
      "status": 1,
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ],
  "duplicated_phone": true,
  "order_currency": "VND",
  "charged_by_vnpay": 1,
  "charged_by_qrpay": 1,
  "custom_id": null,
  "last_editor": {
    "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
    "fb_id": "2042723249341651",
    "name": "Hoang Anh",
    "email": "hoang@example.com",
    "avatar_url": null,
    "phone_number": "0999999999"
  },
  "last_editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
  "charged_by_momo": 1,
  "bank_transfer_images": [
    "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
  ],
  "transfer_money": 1,
  "lock_order_by_user": null,
  "assigning_care": {
    "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
    "fb_id": "2042723249341651",
    "name": "Care Name",
    "email": "care@example.com",
    "avatar_url": null,
    "phone_number": "0999999999"
  },
  "assigning_care_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
  "time_assign_care": "2024-01-01T00:00:00Z",
  "assigning_seller": {
    "id": "340644fc-314d-450e-a45f-33343678cab6",
    "fb_id": "2042723249341651",
    "name": "Seller Name",
    "email": "seller@example.com",
    "avatar_url": null,
    "phone_number": "0999999999"
  },
  "einvoices": [],
  "charged_by_card": 1,
  "estimate_delivery_date": "2024-01-01T00:00:00Z",
  "order_sources": "-1",
  "charged_by_fundiin": 1,
  "surcharge": 1,
  "is_linked_partner": true,
  "call_laters": [],
  "last_update_status_at": "2024-01-01T00:00:00Z",
  "discount_by_customer_level": 1,
  "viewing": [],
  "order_returned_ids": null,
  "cost_surcharge": 1,
  "time_send_partner": "2024-01-01T00:00:00Z",
  "charged_by_kredivo": 1,
  "discount": 1,
  "histories": [],
  "duplicated_customer": true,
  "tax": 1,
  "is_from_ecommerce": true,
  "note_image": [
    "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
  ],
  "shopify_draft_order_id": null,
  "display_id": 1,
  "shop_partner_id": 1,
  "is_locked": true
}
```

## Lấy tin nhắn hội thoại của đơn hàng

`GET /shops/{SHOP_ID}/orders/{ORDER_ID}/messages`

Xác định hội thoại gắn với đơn hàng và trả về tin nhắn của toàn bộ hội thoại. Tin nhắn trong mỗi phản hồi được sắp xếp theo thứ tự thời gian từ cũ đến mới.

Phân trang theo cơ chế hiện tại của ứng dụng Pancake web:
- Bỏ qua `current_count` hoặc đặt bằng `0` để tải tối đa 25 bản ghi mới nhất, được hiển thị theo thứ tự thời gian.
- Để tải các bản ghi cũ hơn, đặt `current_count` bằng tổng số tin nhắn đã tải. Sau phản hồi đầu tiên dùng `25`; nếu phản hồi tiếp theo có 30 tin nhắn thì dùng `55`, và tiếp tục tương tự.
- Các lần gọi có `current_count` lớn hơn `0` trả về tối đa 30 tin nhắn cũ hơn.

Đơn hàng hợp lệ nhưng không có hội thoại liên kết trả về `{"success":true,"data":[]}`.

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |
| `ORDER_ID` | path | string | yes | Mã đơn hàng |
| `current_count` | query | integer |  | Số tin nhắn đã tải. Đây là số lượng dùng làm độ lệch, không phải con trỏ. |
| `fields[]` | query | string[] |  | Các trường cấp cao nhất cần trả về trong mỗi tin nhắn. Lặp lại tham số query để chọn nhiều trường, ví dụ `fields[]=id&fields[]=message`. Bỏ qua để trả về tất cả các trường. |

### Phản hồi

- `200` Conversation messages, an empty data array when the valid order has no conversation, or a legacy authentication error returned with HTTP 200 ()
- `400` The current_count parameter is invalid (ErrorResponse)
- `403` The API key is invalid or disabled, or the authenticated user cannot access order management (ErrorResponse)
- `404` The shop or order does not exist, or the order is not visible to the authenticated API client (ErrorResponse)
- `429` The Open API request rate limit was reached (ErrorResponse)
- `502` The upstream conversation service returned an error (ErrorResponse)
- `504` The upstream conversation service timed out (ErrorResponse)

```json
{
  "success": true,
  "data": [
    {
      "id": "m_hULhobwR0nAa0NzuQaVc3O",
      "type": "INBOX",
      "message": "<div>Xin chào, shop còn size M không?</div>",
      "original_message": "Xin chào, shop còn size M không?",
      "message_tags": [],
      "from": {
        "id": "9306266852780716",
        "name": "Nguyễn Văn A"
      },
      "seen": true,
      "can_like": false,
      "user_likes": false,
      "like_count": null,
      "can_comment": false,
      "comment_count": null,
      "can_remove": false,
      "is_removed": false,
      "is_hidden": false,
      "can_hide": false,
      "can_reply_privately": false,
      "private_reply_conversation": null,
      "attachments": [],
      "has_phone": false,
      "phone_info": [],
      "is_parent": false,
      "inserted_at": "2026-06-25T02:00:38.675576",
      "page_id": "117967746266487",
      "show_info": true,
      "parent_id": null,
      "is_parent_hidden": false,
      "edit_history": null,
      "removed_by": null,
      "rich_message": null,
      "conversation_id": "117967746266487_9306266852780716",
      "is_livestream_order": null
    }
  ]
}
```

## In đơn hàng ra PDF

`GET /shops/{SHOP_ID}/orders/{ORDER_ID}/print`

Điền dữ liệu đơn hàng vào một mẫu in của shop và trả về file PDF, giống khi in đơn trên POS web.

Khi không truyền `label_id`, mẫu in được chọn theo thứ tự: **Mẫu in theo ĐVVC** của đơn vị vận chuyển của đơn, mẫu mặc định của shop, rồi mẫu đầu tiên của shop. Shop chưa có mẫu in thì dùng mẫu hệ thống. Cấu hình **In đơn 2 lần** và **Mẫu in kèm theo** của mẫu đã chọn cũng được áp dụng.

- Khổ trang theo khổ giấy của mẫu in. Giấy cuộn (K80, K58...) trả về một trang có chiều cao vừa nội dung.
- In qua API này không tăng số lần in của đơn.
- Chưa hỗ trợ: biến CRM, dữ liệu hoá đơn điện tử nháp, link theo dõi đơn và link yêu cầu xuất hoá đơn, sản phẩm cấu thành, mẫu in theo nguồn đơn hoặc cho đơn hoàn, và phiếu in do đơn vị vận chuyển cung cấp.

File PDF có thể khác nhẹ so với khi in trên trình duyệt: font chỉ có trên máy người dùng (Segoe UI, Tahoma, Verdana...) được thay thế, và mẫu có nội dung dài hoặc rộng hơn khổ giấy có thể ngắt trang khác. Ảnh do máy chủ tải về: ảnh trên host không công khai, lớn hơn 5 MB, tải quá 5 giây, vượt tổng 15 MB, ngoài 30 URL ảnh đầu tiên của tài liệu, hoặc lặp lại vượt 20 MB dữ liệu ảnh nhúng sẽ để trống. Chỉ ảnh trong `<img>` (`src`/`srcset`) và CSS `url()` được tải; tài nguyên ngoài khác (stylesheet `<link>`, `@import`, SVG `<image href>`, thuộc tính `background`) không được tải.

Lỗi trả về dạng JSON. Với lỗi `404` của đơn hàng và mẫu in và lỗi `503`, `message` theo ngôn ngữ của shop.

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |
| `ORDER_ID` | path | string | yes | Mã đơn hàng, mã hệ thống hoặc mã đơn tùy chỉnh |
| `label_id` | query | integer |  | Mã mẫu in của shop. Bỏ trống để tự chọn mẫu in. |

### Phản hồi

- `200` The order printed as a PDF file, or a legacy authentication error returned with HTTP 200 (ErrorResponse)
- `403` The API key is invalid or disabled, or the authenticated user cannot access order management (ErrorResponse)
- `404` The shop or order does not exist, the order is not visible to the authenticated API client, or `label_id` is not a print template of the shop (ErrorResponse)
- `429` The Open API request rate limit was reached (ErrorResponse)
- `503` The PDF could not be rendered. Retry later. (ErrorResponse)

```json
{
  "success": false,
  "message": "Missing access_token",
  "error_code": 101
}
```

## Danh sách nguồn đơn hàng

`GET /shops/{SHOP_ID}/order_source`

Lấy danh sách nguồn đơn hàng

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |

### Phản hồi

- `200` Success (object)

```json
{
  "data": [
    {
      "id": -3,
      "inserted_at": "2020-06-10T11:50:07",
      "name": "Shopee",
      "shop_id": 7,
      "updated_at": "2020-06-10T11:50:07"
    },
    {
      "id": 4,
      "inserted_at": "2020-06-17T08:41:54",
      "name": "40999897",
      "parent_id": -3,
      "shop_id": 7,
      "updated_at": "2020-06-17T08:41:54"
    },
    {
      "id": "1471242102982974",
      "inserted_at": "2021-04-22T08:33:15",
      "name": "Pancake.vn",
      "parent_id": -1,
      "shop_id": 20,
      "updated_at": "2024-04-08T03:11:25"
    },
    {
      "id": "987654",
      "inserted_at": "2024-05-01T08:00:00",
      "link": "https://landing.example.com/source-abc",
      "name": "Landing ABC",
      "parent_id": -7,
      "shop_id": 20,
      "updated_at": "2024-05-01T08:00:00"
    }
  ],
  "success": true
}
```

## Lấy liên kết in đơn

`POST /shops/{SHOP_ID}/products/get_logistics_shipping_document`

Lấy liên kết in nhãn vận chuyển và phiếu đóng gói

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |
| `document_type` | query | string |  | Loại in Values: `SL_PL` Nhãn vận chuyển + Phiếu đóng gói, `SHIPPING_LABEL` Nhãn vận chuyển, `PICK_LIST` Phiếu đóng gói. |

### Nội dung yêu cầu

Thông tin yêu cầu chứa danh sách mã đơn hàng cần in nhãn

- `params` (object[], required): Danh sách mã đơn hàng
  - `order_id` (string, required): Mã đơn hàng

```json
{
  "params": [
    {
      "order_id": "576551803772635228"
    }
  ]
}
```

### Phản hồi

- `200` Success (object)

```json
{
  "data": [
    "https://content.pancake.vn/2-25/2025/3/28/071edc2cc6c728f6c3fa493a2cb033e8f61fb11e.071edc2cc6c728f6c3fa493a2cb033e8f61fb11e"
  ],
  "success": true
}
```

## Lấy liên kết xác nhận đơn hàng

`POST /shops/{SHOP_ID}/orders/get_tracking_url`

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |

### Nội dung yêu cầu

Thông tin yêu cầu chứa mã hệ thống để lấy URL theo dõi

- `system_id` (integer, required): Mã hệ thống

```json
{
  "system_id": 862
}
```

### Phản hồi

- `200` Success (object)

```json
{
  "url": "https://pke.gg/99gjy3r",
  "success": true
}
```

## Chuẩn bị hàng đơn sàn

`POST /shops/{SHOP_ID}/orders/arrange_shipment`

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |

### Nội dung yêu cầu

Thông tin yêu cầu chứa danh sách mã đơn hàng cần chuẩn bị hàng

- `order_id` (string, required): Mã đơn hàng
- `pickup_shift` (string): Ca nhận hàng. Bắt buộc cho sàn Shopee. Values: `closest` Ca gần nhất, `farthest` Ca xa nhất.
- `pickup_method` (string): Phương thức nhận hàng. Bắt buộc cho sàn Shopee và TikTok. Values: `pick_up` ĐVVC lấy hàng, `drop_off` Mang hàng ra bưu cục.

```json
{
  "order_id": "34123423498237",
  "pickup_shift": "closest",
  "pickup_method": "pick_up"
}
```

### Phản hồi

- `200` Success (object)

```json
{
  "message": "Arrange shipment successfully",
  "success": true
}
```

## Danh sách khuyến mại nâng cao của đơn

`POST /shops/{SHOP_ID}/orders/get_promotion_advance_active`

Lấy danh sách khuyến mại nâng cao có thể áp dụng cho đơn hàng

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |

### Nội dung yêu cầu

Thông tin yêu cầu chứa thông tin đơn hàng (mã đơn hàng đã tồn tại hoặc chi tiết đơn hàng mới) để lấy khuyến mại đang hoạt động


```json
null
```

### Phản hồi

- `200` Success (object)

```json
{
  "id": 1418,
  "system_id": 1,
  "shop_id": 4,
  "inserted_at": "2020-05-12T04:51:42",
  "updated_at": "2020-05-12T04:51:54",
  "status": 0,
  "status_name": "new",
  "bill_full_name": "Hoang Anh",
  "bill_phone_number": "0999999999",
  "bill_email": "customer@example.com",
  "page_id": "256469571178082",
  "post_id": "185187094667903_477083092110915",
  "ad_id": "23851252560290199",
  "shipping_fee": 0,
  "cod": 0,
  "cash": 0,
  "account": 1,
  "total_discount": 0,
  "note": "",
  "note_print": null,
  "received_at_shop": false,
  "is_free_shipping": false,
  "is_locked": false,
  "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
  "creator": {
    "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
    "fb_id": "2042723249341651",
    "name": "Hoang Anh",
    "avatar_url": null
  },
  "items": [],
  "partner": {
    "partner_id": 1,
    "cod": 0,
    "extend_code": "S58824.MB25.C3.500020713",
    "total_fee": 0,
    "updated_at": "2020-05-12T05:18:16"
  },
  "shipping_address": {
    "full_name": "Hoang Anh",
    "phone_number": "0999999999",
    "address": "90 Cầu Giấy",
    "full_address": "90 Cầu Giấy, Phường Dịch Vọng, Quận Cầu Giấy, Hà Nội",
    "province_id": "101",
    "district_id": "10113",
    "commune_id": "1011309"
  }
}
```

## Danh sách phương thức thanh toán

`GET /shops/{SHOP_ID}/bank_payments`

Lấy danh sách phương thức thanh toán

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |

### Phản hồi

- `200` Success (object)

```json
{
  "data": [
    {
      "id": "e01fed02-8680-4102-bdf4-343a7e1a00f5",
      "creator_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
      "name": "Tiền cọc",
      "shop_id": 224,
      "inserted_at": "2025-08-19T02:25:37",
      "updated_at": "2025-08-19T02:25:37"
    }
  ],
  "success": true
}
```

## Danh sách đơn hàng đổi trả

`GET /shops/{SHOP_ID}/orders_returned`

Lấy danh sách đơn hàng đổi trả

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |
| `page` | query | integer |  | Số trang |
| `page_size` | query | integer |  | Kích thước trang |
| `status` | query | integer |  | Trạng thái đơn hàng |
| `update_status` | query | string |  | Lọc đơn hàng theo thời gian Values: `inserted_at` Thời điểm tạo đơn, `updated_at` Thời điểm cập nhật cuối, `0` Mới, `2` Đã gửi hàng, `1` Đã nhận, `4` Đã hủy. |
| `start_time` | query | integer |  | Ngày bắt đầu (unix timestamp) |
| `end_time` | query | integer |  | Ngày kết thúc (unix timestamp) |

### Phản hồi

- `200` Success (object)

```json
{
  "success": true,
  "data": [
    {
      "id": 1,
      "display_id": 1,
      "bill_full_name": "Hoang Anh",
      "bill_phone_number": "0999999999",
      "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
      "custom_id": null,
      "discount": 1,
      "discount_from_order_to_returned": 1,
      "inserted_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z",
      "order_id": 1,
      "order_id_to_returned": 1,
      "order": {
        "id": 1,
        "system_id": 1,
        "shop_id": 1,
        "inserted_at": "2024-01-01T00:00:00Z",
        "updated_at": "2024-01-01T00:00:00Z",
        "status": 1,
        "status_name": "Đã xác nhận",
        "bill_full_name": "Hoang Anh",
        "bill_phone_number": "0999999999",
        "bill_email": "hoang@example.com",
        "page_id": "104438181227821",
        "post_id": "185187094667903_477083092110915",
        "ad_id": "23851252560290199",
        "shipping_fee": 1,
        "partner_fee": 1,
        "fee_marketplace": 1,
        "customer_pay_fee": true,
        "is_free_shipping": true,
        "is_livestream": true,
        "is_live_shopping": true,
        "is_smc": true,
        "received_at_shop": true,
        "total_discount": 1,
        "note": "",
        "note_print": null,
        "returned_reason": 1,
        "returned_reason_name": "Do khách hàng",
        "sub_status": 1,
        "warehouse_id": "b4cb5897-6e56-4581-96cc-2f12677c7bd8",
        "warehouse_info": {
          "name": "kho test ecod",
          "phone_number": "0999999999",
          "full_address": "hâhhha, Xã Bình Trung, Huyện Châu Đức, Bà Rịa-Vũng Tàu",
          "address": "hâhhha",
          "province_id": "717",
          "district_id": "71705",
          "commune_id": "7170510",
          "affiliate_id": null,
          "ffm_id": null,
          "has_snappy_service": true,
          "custom_id": null
        },
        "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "creator": {
          "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
          "fb_id": "2042723249341651",
          "name": "Hoang Anh",
          "avatar_url": null
        },
        "items": [
          {
            "id": 1,
            "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
            "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
            "quantity": 1,
            "returned_count": 1,
            "assigning_seller_id": "340644fc-314d-450e-a45f-33343678cab6",
            "quantity_by_combo_products": [],
            "discount_each_product": 1,
            "is_bonus_product": true,
            "is_discount_percent": true,
            "is_wholesale": true,
            "is_composite": true,
            "one_time_product": true,
            "note": "",
            "note_product": "",
            "inserted_at": "2024-01-01T00:00:00Z",
            "measure_group_id": 1,
            "variation_info": {
              "id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
              "name": "Ao so mi nam",
              "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
              "retail_price": 140000,
              "detail": "",
              "images": [
                "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
              ],
              "fields": [
                {
                  "id": "field-id-1",
                  "name": "Màu",
                  "value": "Trắng",
                  "keyValue": "Màu"
                }
              ],
              "barcode": "BARCODE123",
              "brand_id": null,
              "category_ids": [
                1290021044
              ],
              "display_id": "13109",
              "product_display_id": "a131092025",
              "last_imported_price": 30000,
              "weight": 0,
              "measure_info": {
                "measure_id": 1,
                "exchange_value": 1
              },
              "avg_price": 30000
            },
            "components": [
              {
                "component_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
                "quantity": 1,
                "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7"
              }
            ]
          }
        ],
        "partner": {
          "partner_id": 1,
          "cod": 0,
          "extend_code": "S58824.MB25.C3.500020713",
          "total_fee": 0,
          "updated_at": "2020-05-12T05:18:16",
          "delivery_name": null,
          "delivery_tel": null,
          "picked_up_at": null,
          "sort_code": null,
          "paid_at": null,
          "system_created": true,
          "extend_update": [
            {
              "key": "status",
              "status": "delivered",
              "tracking_id": "S58824.MB25.C3.500020713",
              "note": "",
              "update_at": "2020-05-12T05:18:16"
            }
          ]
        },
        "shipping_address": {
          "full_name": "Hoang Anh",
          "phone_number": "0999999999",
          "address": "90 Cầu Giấy",
          "full_address": "90 Cầu Giấy, Phường Dịch Vọng, Quận Cầu Giấy, Hà Nội",
          "province_id": "101",
          "district_id": "10113",
          "commune_id": "1011309",
          "commnue_name": "Phường Dịch Vọng",
          "district_name": "Quận Cầu Giấy",
          "province_name": "Hà Nội",
          "country_code": "84",
          "post_code": null
        },
        "payment_purchase_histories": [
          {
            "amount": 1800000,
            "type": "cash",
            "inserted_at": "2024-01-01T00:00:00Z",
            "result_code": "00",
            "ipn_reply": true,
            "voucher_amount": 0,
            "tags": [
              "payment"
            ]
          }
        ],
        "tags": [
          {
            "id": 75,
            "name": "thẻ 4"
          }
        ],
        "marketer": {
          "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
          "name": "Marketer Name",
          "email": "marketer@example.com",
          "phone_number": "0999999999",
          "fb_id": "2042723249341651",
          "avatar_url": null
        },
        "pke_mkter": "cee3c05e-5f85-43c4-b27e-889b99c50097",
        "activated_combo_products": {
          "combo_product_id": 1,
          "quantity_combo_activated": 1
        },
        "activated_promotion_advances": [
          {
            "id": 1,
            "promotion_advance_id": "fb056b32-9cf6-4c5a-92de-0eb94db71121"
          }
        ],
        "tracking_link": "https://tracking.example.com",
        "payment_link": "https://payment.example.com",
        "ads_source": null,
        "shopify_order_id": null,
        "shopify_abandon_checkout_id": 1,
        "is_abandoned_order": true,
        "cod": 0,
        "cash": 0,
        "account": 1,
        "account_name": "facebook321",
        "advanced_platform_fee": {
          "ads_top_up": 1,
          "affiliate_commission": 1,
          "diff_shipping_fee": 1,
          "marketplace_voucher": 1,
          "payment_fee": 1,
          "platform_commission": 1,
          "seller_transaction_fee": 1,
          "service_fee": 1,
          "sfp_service_fee": 1
        },
        "printing_count": 1,
        "money_to_collect": 1,
        "total_price": 1,
        "shop_customer_address_id": "0fefd213-7d0c-4d5b-bdbf-35694da80857",
        "customer": {
          "fb_id": null,
          "id": "96a8e283-3fba-492e-a35a-970f72a30a02",
          "name": "Trần Văn Hoàng",
          "page_id": "104438181227821"
        },
        "total_quantity": 1,
        "time_assign_marketer": "2024-01-01T00:00:00Z",
        "status_history": [
          {
            "avatar_url": null,
            "editor_fb": "2042723249341651",
            "editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
            "name": "Hoang Anh",
            "old_status": 0,
            "status": 1,
            "updated_at": "2024-01-01T00:00:00Z"
          }
        ],
        "duplicated_phone": true,
        "order_currency": "VND",
        "charged_by_vnpay": 1,
        "charged_by_qrpay": 1,
        "custom_id": null,
        "last_editor": {
          "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
          "fb_id": "2042723249341651",
          "name": "Hoang Anh",
          "email": "hoang@example.com",
          "avatar_url": null,
          "phone_number": "0999999999"
        },
        "last_editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "charged_by_momo": 1,
        "bank_transfer_images": [
          "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
        ],
        "transfer_money": 1,
        "lock_order_by_user": null,
        "assigning_care": {
          "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
          "fb_id": "2042723249341651",
          "name": "Care Name",
          "email": "care@example.com",
          "avatar_url": null,
          "phone_number": "0999999999"
        },
        "assigning_care_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
        "time_assign_care": "2024-01-01T00:00:00Z",
        "assigning_seller": {
          "id": "340644fc-314d-450e-a45f-33343678cab6",
          "fb_id": "2042723249341651",
          "name": "Seller Name",
          "email": "seller@example.com",
          "avatar_url": null,
          "phone_number": "0999999999"
        },
        "einvoices": [],
        "charged_by_card": 1,
        "estimate_delivery_date": "2024-01-01T00:00:00Z",
        "order_sources": "-1",
        "charged_by_fundiin": 1,
        "surcharge": 1,
        "is_linked_partner": true,
        "call_laters": [],
        "last_update_status_at": "2024-01-01T00:00:00Z",
        "discount_by_customer_level": 1,
        "viewing": [],
        "order_returned_ids": null,
        "cost_surcharge": 1,
        "time_send_partner": "2024-01-01T00:00:00Z",
        "charged_by_kredivo": 1,
        "discount": 1,
        "histories": [],
        "duplicated_customer": true,
        "tax": 1,
        "is_from_ecommerce": true,
        "note_image": [
          "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
        ],
        "shopify_draft_order_id": null,
        "display_id": 1,
        "shop_partner_id": 1,
        "is_locked": true
      },
      "order_to_returned": {
        "id": 1,
        "system_id": 1,
        "shop_id": 1,
        "inserted_at": "2024-01-01T00:00:00Z",
        "updated_at": "2024-01-01T00:00:00Z",
        "status": 1,
        "status_name": "Đã xác nhận",
        "bill_full_name": "Hoang Anh",
        "bill_phone_number": "0999999999",
        "bill_email": "hoang@example.com",
        "page_id": "104438181227821",
        "post_id": "185187094667903_477083092110915",
        "ad_id": "23851252560290199",
        "shipping_fee": 1,
        "partner_fee": 1,
        "fee_marketplace": 1,
        "customer_pay_fee": true,
        "is_free_shipping": true,
        "is_livestream": true,
        "is_live_shopping": true,
        "is_smc": true,
        "received_at_shop": true,
        "total_discount": 1,
        "note": "",
        "note_print": null,
        "returned_reason": 1,
        "returned_reason_name": "Do khách hàng",
        "sub_status": 1,
        "warehouse_id": "b4cb5897-6e56-4581-96cc-2f12677c7bd8",
        "warehouse_info": {
          "name": "kho test ecod",
          "phone_number": "0999999999",
          "full_address": "hâhhha, Xã Bình Trung, Huyện Châu Đức, Bà Rịa-Vũng Tàu",
          "address": "hâhhha",
          "province_id": "717",
          "district_id": "71705",
          "commune_id": "7170510",
          "affiliate_id": null,
          "ffm_id": null,
          "has_snappy_service": true,
          "custom_id": null
        },
        "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "creator": {
          "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
          "fb_id": "2042723249341651",
          "name": "Hoang Anh",
          "avatar_url": null
        },
        "items": [
          {
            "id": 1,
            "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
            "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
            "quantity": 1,
            "returned_count": 1,
            "assigning_seller_id": "340644fc-314d-450e-a45f-33343678cab6",
            "quantity_by_combo_products": [],
            "discount_each_product": 1,
            "is_bonus_product": true,
            "is_discount_percent": true,
            "is_wholesale": true,
            "is_composite": true,
            "one_time_product": true,
            "note": "",
            "note_product": "",
            "inserted_at": "2024-01-01T00:00:00Z",
            "measure_group_id": 1,
            "variation_info": {
              "id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
              "name": "Ao so mi nam",
              "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
              "retail_price": 140000,
              "detail": "",
              "images": [
                "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
              ],
              "fields": [
                {
                  "id": "field-id-1",
                  "name": "Màu",
                  "value": "Trắng",
                  "keyValue": "Màu"
                }
              ],
              "barcode": "BARCODE123",
              "brand_id": null,
              "category_ids": [
                1290021044
              ],
              "display_id": "13109",
              "product_display_id": "a131092025",
              "last_imported_price": 30000,
              "weight": 0,
              "measure_info": {
                "measure_id": 1,
                "exchange_value": 1
              },
              "avg_price": 30000
            },
            "components": [
              {
                "component_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
                "quantity": 1,
                "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7"
              }
            ]
          }
        ],
        "partner": {
          "partner_id": 1,
          "cod": 0,
          "extend_code": "S58824.MB25.C3.500020713",
          "total_fee": 0,
          "updated_at": "2020-05-12T05:18:16",
          "delivery_name": null,
          "delivery_tel": null,
          "picked_up_at": null,
          "sort_code": null,
          "paid_at": null,
          "system_created": true,
          "extend_update": [
            {
              "key": "status",
              "status": "delivered",
              "tracking_id": "S58824.MB25.C3.500020713",
              "note": "",
              "update_at": "2020-05-12T05:18:16"
            }
          ]
        },
        "shipping_address": {
          "full_name": "Hoang Anh",
          "phone_number": "0999999999",
          "address": "90 Cầu Giấy",
          "full_address": "90 Cầu Giấy, Phường Dịch Vọng, Quận Cầu Giấy, Hà Nội",
          "province_id": "101",
          "district_id": "10113",
          "commune_id": "1011309",
          "commnue_name": "Phường Dịch Vọng",
          "district_name": "Quận Cầu Giấy",
          "province_name": "Hà Nội",
          "country_code": "84",
          "post_code": null
        },
        "payment_purchase_histories": [
          {
            "amount": 1800000,
            "type": "cash",
            "inserted_at": "2024-01-01T00:00:00Z",
            "result_code": "00",
            "ipn_reply": true,
            "voucher_amount": 0,
            "tags": [
              "payment"
            ]
          }
        ],
        "tags": [
          {
            "id": 75,
            "name": "thẻ 4"
          }
        ],
        "marketer": {
          "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
          "name": "Marketer Name",
          "email": "marketer@example.com",
          "phone_number": "0999999999",
          "fb_id": "2042723249341651",
          "avatar_url": null
        },
        "pke_mkter": "cee3c05e-5f85-43c4-b27e-889b99c50097",
        "activated_combo_products": {
          "combo_product_id": 1,
          "quantity_combo_activated": 1
        },
        "activated_promotion_advances": [
          {
            "id": 1,
            "promotion_advance_id": "fb056b32-9cf6-4c5a-92de-0eb94db71121"
          }
        ],
        "tracking_link": "https://tracking.example.com",
        "payment_link": "https://payment.example.com",
        "ads_source": null,
        "shopify_order_id": null,
        "shopify_abandon_checkout_id": 1,
        "is_abandoned_order": true,
        "cod": 0,
        "cash": 0,
        "account": 1,
        "account_name": "facebook321",
        "advanced_platform_fee": {
          "ads_top_up": 1,
          "affiliate_commission": 1,
          "diff_shipping_fee": 1,
          "marketplace_voucher": 1,
          "payment_fee": 1,
          "platform_commission": 1,
          "seller_transaction_fee": 1,
          "service_fee": 1,
          "sfp_service_fee": 1
        },
        "printing_count": 1,
        "money_to_collect": 1,
        "total_price": 1,
        "shop_customer_address_id": "0fefd213-7d0c-4d5b-bdbf-35694da80857",
        "customer": {
          "fb_id": null,
          "id": "96a8e283-3fba-492e-a35a-970f72a30a02",
          "name": "Trần Văn Hoàng",
          "page_id": "104438181227821"
        },
        "total_quantity": 1,
        "time_assign_marketer": "2024-01-01T00:00:00Z",
        "status_history": [
          {
            "avatar_url": null,
            "editor_fb": "2042723249341651",
            "editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
            "name": "Hoang Anh",
            "old_status": 0,
            "status": 1,
            "updated_at": "2024-01-01T00:00:00Z"
          }
        ],
        "duplicated_phone": true,
        "order_currency": "VND",
        "charged_by_vnpay": 1,
        "charged_by_qrpay": 1,
        "custom_id": null,
        "last_editor": {
          "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
          "fb_id": "2042723249341651",
          "name": "Hoang Anh",
          "email": "hoang@example.com",
          "avatar_url": null,
          "phone_number": "0999999999"
        },
        "last_editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "charged_by_momo": 1,
        "bank_transfer_images": [
          "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
        ],
        "transfer_money": 1,
        "lock_order_by_user": null,
        "assigning_care": {
          "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
          "fb_id": "2042723249341651",
          "name": "Care Name",
          "email": "care@example.com",
          "avatar_url": null,
          "phone_number": "0999999999"
        },
        "assigning_care_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
        "time_assign_care": "2024-01-01T00:00:00Z",
        "assigning_seller": {
          "id": "340644fc-314d-450e-a45f-33343678cab6",
          "fb_id": "2042723249341651",
          "name": "Seller Name",
          "email": "seller@example.com",
          "avatar_url": null,
          "phone_number": "0999999999"
        },
        "einvoices": [],
        "charged_by_card": 1,
        "estimate_delivery_date": "2024-01-01T00:00:00Z",
        "order_sources": "-1",
        "charged_by_fundiin": 1,
        "surcharge": 1,
        "is_linked_partner": true,
        "call_laters": [],
        "last_update_status_at": "2024-01-01T00:00:00Z",
        "discount_by_customer_level": 1,
        "viewing": [],
        "order_returned_ids": null,
        "cost_surcharge": 1,
        "time_send_partner": "2024-01-01T00:00:00Z",
        "charged_by_kredivo": 1,
        "discount": 1,
        "histories": [],
        "duplicated_customer": true,
        "tax": 1,
        "is_from_ecommerce": true,
        "note_image": [
          "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
        ],
        "shopify_draft_order_id": null,
        "display_id": 1,
        "shop_partner_id": 1,
        "is_locked": true
      },
      "returned_items": [
        {
          "id": 1,
          "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
          "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
          "returned_quantity": 1,
          "discount_each_product": 1,
          "is_discount_percent": true
        }
      ],
      "returned_fee": 1,
      "shop_customer_id": "96a8e283-3fba-492e-a35a-970f72a30a02",
      "shop_id": 1,
      "status": 1,
      "status_histories": [
        {
          "id": 1,
          "editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
          "old_status": 0,
          "status": 1,
          "inserted_at": "2024-01-01T00:00:00Z",
          "updated_at": "2024-01-01T00:00:00Z"
        }
      ],
      "tags": [
        1
      ],
      "warehouse_id": "b4cb5897-6e56-4581-96cc-2f12677c7bd8"
    }
  ]
}
```

## Tạo đơn đổi trả

`POST /shops/{SHOP_ID}/orders_returned`

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |

### Nội dung yêu cầu

Thông tin yêu cầu chứa thông tin đơn đổi trả

- `discount_from_order_to_returned` (integer): Giảm giá từ đơn hàng đến đơn đổi trả
- `order_additional` (object, required): Thông tin đơn đổi
  - `bill_email` (string): Email khách hàng
  - `bill_full_name` (string): Tên khách hàng
  - `bill_phone_number` (string): SĐT khách hàng
  - `cash` (integer): Tiền mặt
  - `discount` (integer): Tổng tiền giảm giá
  - `items` (object[], required): Danh sách sản phẩm trong đơn đổi
  - `note` (string): Ghi chú nội bộ
  - `note_print` (string): Ghi chú in
  - `order_currency` (string): Tiền tệ đơn hàng
  - `payment_from_customers_exchange_order` (integer): Thanh toán từ khách hàng đơn đổi
  - `prepaid` (integer): Số tiền đã trả trước
  - `received_at_shop` (boolean): true: Bán tại quầy, false: Bán online
  - `shipping_address` (object): Thông tin địa chỉ giao hàng
  - `shipping_fee` (integer): Phí vận chuyển
  - `shop_customer_id` (string): Mã khách hàng
  - `surcharge` (integer): Phụ phí
  - `warehouse_id` (string, required): Mã kho hàng
- `order_to_returned` (object): Đơn hàng cần trả
  - `id` (string): Mã đơn hàng cần trả
- `returned_items` (object[], required): Danh sách sản phẩm trong đơn trả
  - `product_id` (string, required): Mã sản phẩm
  - `returned_quantity` (integer, required): Số lượng trả
  - `variation_id` (string, required): Mã biến thể
  - `variation_info` (object, required): Thông tin biến thể
- `shop_customer_id` (string): Mã khách hàng
- `status` (integer, required): Trạng thái đơn hàng
- `warehouse_id` (string, required): Mã kho hàng

```json
{
  "discount_from_order_to_returned": 50000,
  "order_additional": {
    "bill_email": "",
    "bill_full_name": "Lê Văn Tám",
    "bill_phone_number": "0384596873",
    "cash": 1,
    "discount": 20000,
    "items": [
      {
        "discount_each_product": 0,
        "product_id": "db7cb77a-64c4-4572-9cca-86e846c0897c",
        "quantity": 1,
        "returned_quantity": 1,
        "variation_id": "749f52be-2bd0-4e76-b9fd-a4914c53192a",
        "variation_info": {
          "detail": "size: XL, color: blue",
          "fields": [
            {
              "id": "25698fb6-158e-472f-a8a7-fa48250337ae",
              "keyValue": "XL",
              "name": "size",
              "value": "XL"
            },
            {
              "id": "c414ff3c-cba7-497c-a6f8-13355605b391",
              "keyValue": "BLUE",
              "name": "color",
              "value": "blue"
            }
          ],
          "images": [
            "https://content.pancake.vn/2/2022/1/19/18c4500c320cb2e993b3ff4b3be81165df64d3ba.png"
          ],
          "name": "Sao chép Áo nam thời trang Pari",
          "retail_price": 500000,
          "weight": 100
        }
      }
    ],
    "note": "đơn trả hàng",
    "note_print": "đơn trả hàng",
    "order_currency": "VND",
    "payment_from_customers_exchange_order": 150000,
    "prepaid": 123,
    "received_at_shop": false,
    "shipping_address": {
      "address": "BT2-12 ngõ 178910",
      "commune_id": "1012129",
      "country_code": "84",
      "district_id": "10121",
      "full_address": "BT2-12 ngõ 178, Phường Đại Mỗ, Quận Nam Từ Liêm, Hà Nội",
      "full_name": "Nguyễn Hải Nhạn",
      "new_full_address": "BT2-12 ngõ 178, Hà Nội",
      "phone_number": "0384596873",
      "province_id": "101",
      "render_type": "old"
    },
    "shipping_fee": 0,
    "shop_customer_id": "ef9fc5ef-b4b5-4682-a1b9-b7ea259ae353",
    "surcharge": 0,
    "warehouse_id": "4051d111-a6b6-44fb-aca1-61fb954298cb"
  },
  "order_to_returned": {
    "id": "123157"
  },
  "returned_items": [
    {
      "product_id": "6c998441-146b-4daa-b8e0-313a2a543623",
      "returned_quantity": 1,
      "variation_id": "efac90c8-0ba7-4aa0-bef6-8f4be3c0c6e6",
      "variation_info": {
        "name": "[HỎA TỐC] Phồng Tôm Cà Mau VITOT Bánh Phồng Tôm Loại Cao Cấp Với Tỉ Lệ Tôm 48%, Đậm Đà Vị Tôm",
        "retail_price": 200000,
        "images": [
          "https://content.pancake.vn/user-content-dev2.pancake.vn/2024/12/31/a549582c91f1bee856f8a4383408de4f10585fac.jpg"
        ],
        "fields": [
          {
            "id": "995a0b6d-4e08-493e-b776-0afb2138e8a7",
            "name": "PHÂN LOẠI",
            "value": "1 HỘP CÀ MAU"
          }
        ],
        "detail": "PHÂN LOẠI: 1 HỘP CÀ MAU"
      }
    }
  ],
  "shop_customer_id": "ef9fc5ef-b4b5-4682-a1b9-b7ea259ae353",
  "status": 2,
  "warehouse_id": "4051d111-a6b6-44fb-aca1-61fb954298cb"
}
```

### Phản hồi

- `200` Success (ReturnOrder)

```json
{
  "id": 1,
  "display_id": 1,
  "bill_full_name": "Hoang Anh",
  "bill_phone_number": "0999999999",
  "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
  "custom_id": null,
  "discount": 1,
  "discount_from_order_to_returned": 1,
  "inserted_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-01T00:00:00Z",
  "order_id": 1,
  "order_id_to_returned": 1,
  "order": {
    "id": 1,
    "system_id": 1,
    "shop_id": 1,
    "inserted_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z",
    "status": 1,
    "status_name": "Đã xác nhận",
    "bill_full_name": "Hoang Anh",
    "bill_phone_number": "0999999999",
    "bill_email": "hoang@example.com",
    "page_id": "104438181227821",
    "post_id": "185187094667903_477083092110915",
    "ad_id": "23851252560290199",
    "shipping_fee": 1,
    "partner_fee": 1,
    "fee_marketplace": 1,
    "customer_pay_fee": true,
    "is_free_shipping": true,
    "is_livestream": true,
    "is_live_shopping": true,
    "is_smc": true,
    "received_at_shop": true,
    "total_discount": 1,
    "note": "",
    "note_print": null,
    "returned_reason": 1,
    "returned_reason_name": "Do khách hàng",
    "sub_status": 1,
    "warehouse_id": "b4cb5897-6e56-4581-96cc-2f12677c7bd8",
    "warehouse_info": {
      "name": "kho test ecod",
      "phone_number": "0999999999",
      "full_address": "hâhhha, Xã Bình Trung, Huyện Châu Đức, Bà Rịa-Vũng Tàu",
      "address": "hâhhha",
      "province_id": "717",
      "district_id": "71705",
      "commune_id": "7170510",
      "affiliate_id": null,
      "ffm_id": null,
      "has_snappy_service": true,
      "custom_id": null
    },
    "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
    "creator": {
      "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
      "fb_id": "2042723249341651",
      "name": "Hoang Anh",
      "avatar_url": null
    },
    "items": [
      {
        "id": 1,
        "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
        "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
        "quantity": 1,
        "returned_count": 1,
        "assigning_seller_id": "340644fc-314d-450e-a45f-33343678cab6",
        "quantity_by_combo_products": [],
        "discount_each_product": 1,
        "is_bonus_product": true,
        "is_discount_percent": true,
        "is_wholesale": true,
        "is_composite": true,
        "one_time_product": true,
        "note": "",
        "note_product": "",
        "inserted_at": "2024-01-01T00:00:00Z",
        "measure_group_id": 1,
        "variation_info": {
          "id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
          "name": "Ao so mi nam",
          "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
          "retail_price": 140000,
          "detail": "",
          "images": [
            "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
          ],
          "fields": [
            {
              "id": "field-id-1",
              "name": "Màu",
              "value": "Trắng",
              "keyValue": "Màu"
            }
          ],
          "barcode": "BARCODE123",
          "brand_id": null,
          "category_ids": [
            1290021044
          ],
          "display_id": "13109",
          "product_display_id": "a131092025",
          "last_imported_price": 30000,
          "weight": 0,
          "measure_info": {
            "measure_id": 1,
            "exchange_value": 1
          },
          "avg_price": 30000
        },
        "components": [
          {
            "component_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
            "quantity": 1,
            "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7"
          }
        ]
      }
    ],
    "partner": {
      "partner_id": 1,
      "cod": 0,
      "extend_code": "S58824.MB25.C3.500020713",
      "total_fee": 0,
      "updated_at": "2020-05-12T05:18:16",
      "delivery_name": null,
      "delivery_tel": null,
      "picked_up_at": null,
      "sort_code": null,
      "paid_at": null,
      "system_created": true,
      "extend_update": [
        {
          "key": "status",
          "status": "delivered",
          "tracking_id": "S58824.MB25.C3.500020713",
          "note": "",
          "update_at": "2020-05-12T05:18:16"
        }
      ]
    },
    "shipping_address": {
      "full_name": "Hoang Anh",
      "phone_number": "0999999999",
      "address": "90 Cầu Giấy",
      "full_address": "90 Cầu Giấy, Phường Dịch Vọng, Quận Cầu Giấy, Hà Nội",
      "province_id": "101",
      "district_id": "10113",
      "commune_id": "1011309",
      "commnue_name": "Phường Dịch Vọng",
      "district_name": "Quận Cầu Giấy",
      "province_name": "Hà Nội",
      "country_code": "84",
      "post_code": null
    },
    "payment_purchase_histories": [
      {
        "amount": 1800000,
        "type": "cash",
        "inserted_at": "2024-01-01T00:00:00Z",
        "result_code": "00",
        "ipn_reply": true,
        "voucher_amount": 0,
        "tags": [
          "payment"
        ]
      }
    ],
    "tags": [
      {
        "id": 75,
        "name": "thẻ 4"
      }
    ],
    "marketer": {
      "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
      "name": "Marketer Name",
      "email": "marketer@example.com",
      "phone_number": "0999999999",
      "fb_id": "2042723249341651",
      "avatar_url": null
    },
    "pke_mkter": "cee3c05e-5f85-43c4-b27e-889b99c50097",
    "activated_combo_products": {
      "combo_product_id": 1,
      "quantity_combo_activated": 1
    },
    "activated_promotion_advances": [
      {
        "id": 1,
        "promotion_advance_id": "fb056b32-9cf6-4c5a-92de-0eb94db71121"
      }
    ],
    "tracking_link": "https://tracking.example.com",
    "payment_link": "https://payment.example.com",
    "ads_source": null,
    "shopify_order_id": null,
    "shopify_abandon_checkout_id": 1,
    "is_abandoned_order": true,
    "cod": 0,
    "cash": 0,
    "account": 1,
    "account_name": "facebook321",
    "advanced_platform_fee": {
      "ads_top_up": 1,
      "affiliate_commission": 1,
      "diff_shipping_fee": 1,
      "marketplace_voucher": 1,
      "payment_fee": 1,
      "platform_commission": 1,
      "seller_transaction_fee": 1,
      "service_fee": 1,
      "sfp_service_fee": 1
    },
    "printing_count": 1,
    "money_to_collect": 1,
    "total_price": 1,
    "shop_customer_address_id": "0fefd213-7d0c-4d5b-bdbf-35694da80857",
    "customer": {
      "fb_id": null,
      "id": "96a8e283-3fba-492e-a35a-970f72a30a02",
      "name": "Trần Văn Hoàng",
      "page_id": "104438181227821"
    },
    "total_quantity": 1,
    "time_assign_marketer": "2024-01-01T00:00:00Z",
    "status_history": [
      {
        "avatar_url": null,
        "editor_fb": "2042723249341651",
        "editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "name": "Hoang Anh",
        "old_status": 0,
        "status": 1,
        "updated_at": "2024-01-01T00:00:00Z"
      }
    ],
    "duplicated_phone": true,
    "order_currency": "VND",
    "charged_by_vnpay": 1,
    "charged_by_qrpay": 1,
    "custom_id": null,
    "last_editor": {
      "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
      "fb_id": "2042723249341651",
      "name": "Hoang Anh",
      "email": "hoang@example.com",
      "avatar_url": null,
      "phone_number": "0999999999"
    },
    "last_editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
    "charged_by_momo": 1,
    "bank_transfer_images": [
      "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
    ],
    "transfer_money": 1,
    "lock_order_by_user": null,
    "assigning_care": {
      "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
      "fb_id": "2042723249341651",
      "name": "Care Name",
      "email": "care@example.com",
      "avatar_url": null,
      "phone_number": "0999999999"
    },
    "assigning_care_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
    "time_assign_care": "2024-01-01T00:00:00Z",
    "assigning_seller": {
      "id": "340644fc-314d-450e-a45f-33343678cab6",
      "fb_id": "2042723249341651",
      "name": "Seller Name",
      "email": "seller@example.com",
      "avatar_url": null,
      "phone_number": "0999999999"
    },
    "einvoices": [],
    "charged_by_card": 1,
    "estimate_delivery_date": "2024-01-01T00:00:00Z",
    "order_sources": "-1",
    "charged_by_fundiin": 1,
    "surcharge": 1,
    "is_linked_partner": true,
    "call_laters": [],
    "last_update_status_at": "2024-01-01T00:00:00Z",
    "discount_by_customer_level": 1,
    "viewing": [],
    "order_returned_ids": null,
    "cost_surcharge": 1,
    "time_send_partner": "2024-01-01T00:00:00Z",
    "charged_by_kredivo": 1,
    "discount": 1,
    "histories": [],
    "duplicated_customer": true,
    "tax": 1,
    "is_from_ecommerce": true,
    "note_image": [
      "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
    ],
    "shopify_draft_order_id": null,
    "display_id": 1,
    "shop_partner_id": 1,
    "is_locked": true
  },
  "order_to_returned": {
    "id": 1,
    "system_id": 1,
    "shop_id": 1,
    "inserted_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z",
    "status": 1,
    "status_name": "Đã xác nhận",
    "bill_full_name": "Hoang Anh",
    "bill_phone_number": "0999999999",
    "bill_email": "hoang@example.com",
    "page_id": "104438181227821",
    "post_id": "185187094667903_477083092110915",
    "ad_id": "23851252560290199",
    "shipping_fee": 1,
    "partner_fee": 1,
    "fee_marketplace": 1,
    "customer_pay_fee": true,
    "is_free_shipping": true,
    "is_livestream": true,
    "is_live_shopping": true,
    "is_smc": true,
    "received_at_shop": true,
    "total_discount": 1,
    "note": "",
    "note_print": null,
    "returned_reason": 1,
    "returned_reason_name": "Do khách hàng",
    "sub_status": 1,
    "warehouse_id": "b4cb5897-6e56-4581-96cc-2f12677c7bd8",
    "warehouse_info": {
      "name": "kho test ecod",
      "phone_number": "0999999999",
      "full_address": "hâhhha, Xã Bình Trung, Huyện Châu Đức, Bà Rịa-Vũng Tàu",
      "address": "hâhhha",
      "province_id": "717",
      "district_id": "71705",
      "commune_id": "7170510",
      "affiliate_id": null,
      "ffm_id": null,
      "has_snappy_service": true,
      "custom_id": null
    },
    "creator_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
    "creator": {
      "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
      "fb_id": "2042723249341651",
      "name": "Hoang Anh",
      "avatar_url": null
    },
    "items": [
      {
        "id": 1,
        "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
        "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
        "quantity": 1,
        "returned_count": 1,
        "assigning_seller_id": "340644fc-314d-450e-a45f-33343678cab6",
        "quantity_by_combo_products": [],
        "discount_each_product": 1,
        "is_bonus_product": true,
        "is_discount_percent": true,
        "is_wholesale": true,
        "is_composite": true,
        "one_time_product": true,
        "note": "",
        "note_product": "",
        "inserted_at": "2024-01-01T00:00:00Z",
        "measure_group_id": 1,
        "variation_info": {
          "id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
          "name": "Ao so mi nam",
          "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
          "retail_price": 140000,
          "detail": "",
          "images": [
            "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
          ],
          "fields": [
            {
              "id": "field-id-1",
              "name": "Màu",
              "value": "Trắng",
              "keyValue": "Màu"
            }
          ],
          "barcode": "BARCODE123",
          "brand_id": null,
          "category_ids": [
            1290021044
          ],
          "display_id": "13109",
          "product_display_id": "a131092025",
          "last_imported_price": 30000,
          "weight": 0,
          "measure_info": {
            "measure_id": 1,
            "exchange_value": 1
          },
          "avg_price": 30000
        },
        "components": [
          {
            "component_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
            "quantity": 1,
            "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7"
          }
        ]
      }
    ],
    "partner": {
      "partner_id": 1,
      "cod": 0,
      "extend_code": "S58824.MB25.C3.500020713",
      "total_fee": 0,
      "updated_at": "2020-05-12T05:18:16",
      "delivery_name": null,
      "delivery_tel": null,
      "picked_up_at": null,
      "sort_code": null,
      "paid_at": null,
      "system_created": true,
      "extend_update": [
        {
          "key": "status",
          "status": "delivered",
          "tracking_id": "S58824.MB25.C3.500020713",
          "note": "",
          "update_at": "2020-05-12T05:18:16"
        }
      ]
    },
    "shipping_address": {
      "full_name": "Hoang Anh",
      "phone_number": "0999999999",
      "address": "90 Cầu Giấy",
      "full_address": "90 Cầu Giấy, Phường Dịch Vọng, Quận Cầu Giấy, Hà Nội",
      "province_id": "101",
      "district_id": "10113",
      "commune_id": "1011309",
      "commnue_name": "Phường Dịch Vọng",
      "district_name": "Quận Cầu Giấy",
      "province_name": "Hà Nội",
      "country_code": "84",
      "post_code": null
    },
    "payment_purchase_histories": [
      {
        "amount": 1800000,
        "type": "cash",
        "inserted_at": "2024-01-01T00:00:00Z",
        "result_code": "00",
        "ipn_reply": true,
        "voucher_amount": 0,
        "tags": [
          "payment"
        ]
      }
    ],
    "tags": [
      {
        "id": 75,
        "name": "thẻ 4"
      }
    ],
    "marketer": {
      "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
      "name": "Marketer Name",
      "email": "marketer@example.com",
      "phone_number": "0999999999",
      "fb_id": "2042723249341651",
      "avatar_url": null
    },
    "pke_mkter": "cee3c05e-5f85-43c4-b27e-889b99c50097",
    "activated_combo_products": {
      "combo_product_id": 1,
      "quantity_combo_activated": 1
    },
    "activated_promotion_advances": [
      {
        "id": 1,
        "promotion_advance_id": "fb056b32-9cf6-4c5a-92de-0eb94db71121"
      }
    ],
    "tracking_link": "https://tracking.example.com",
    "payment_link": "https://payment.example.com",
    "ads_source": null,
    "shopify_order_id": null,
    "shopify_abandon_checkout_id": 1,
    "is_abandoned_order": true,
    "cod": 0,
    "cash": 0,
    "account": 1,
    "account_name": "facebook321",
    "advanced_platform_fee": {
      "ads_top_up": 1,
      "affiliate_commission": 1,
      "diff_shipping_fee": 1,
      "marketplace_voucher": 1,
      "payment_fee": 1,
      "platform_commission": 1,
      "seller_transaction_fee": 1,
      "service_fee": 1,
      "sfp_service_fee": 1
    },
    "printing_count": 1,
    "money_to_collect": 1,
    "total_price": 1,
    "shop_customer_address_id": "0fefd213-7d0c-4d5b-bdbf-35694da80857",
    "customer": {
      "fb_id": null,
      "id": "96a8e283-3fba-492e-a35a-970f72a30a02",
      "name": "Trần Văn Hoàng",
      "page_id": "104438181227821"
    },
    "total_quantity": 1,
    "time_assign_marketer": "2024-01-01T00:00:00Z",
    "status_history": [
      {
        "avatar_url": null,
        "editor_fb": "2042723249341651",
        "editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
        "name": "Hoang Anh",
        "old_status": 0,
        "status": 1,
        "updated_at": "2024-01-01T00:00:00Z"
      }
    ],
    "duplicated_phone": true,
    "order_currency": "VND",
    "charged_by_vnpay": 1,
    "charged_by_qrpay": 1,
    "custom_id": null,
    "last_editor": {
      "id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
      "fb_id": "2042723249341651",
      "name": "Hoang Anh",
      "email": "hoang@example.com",
      "avatar_url": null,
      "phone_number": "0999999999"
    },
    "last_editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
    "charged_by_momo": 1,
    "bank_transfer_images": [
      "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
    ],
    "transfer_money": 1,
    "lock_order_by_user": null,
    "assigning_care": {
      "id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
      "fb_id": "2042723249341651",
      "name": "Care Name",
      "email": "care@example.com",
      "avatar_url": null,
      "phone_number": "0999999999"
    },
    "assigning_care_id": "cee3c05e-5f85-43c4-b27e-889b99c50097",
    "time_assign_care": "2024-01-01T00:00:00Z",
    "assigning_seller": {
      "id": "340644fc-314d-450e-a45f-33343678cab6",
      "fb_id": "2042723249341651",
      "name": "Seller Name",
      "email": "seller@example.com",
      "avatar_url": null,
      "phone_number": "0999999999"
    },
    "einvoices": [],
    "charged_by_card": 1,
    "estimate_delivery_date": "2024-01-01T00:00:00Z",
    "order_sources": "-1",
    "charged_by_fundiin": 1,
    "surcharge": 1,
    "is_linked_partner": true,
    "call_laters": [],
    "last_update_status_at": "2024-01-01T00:00:00Z",
    "discount_by_customer_level": 1,
    "viewing": [],
    "order_returned_ids": null,
    "cost_surcharge": 1,
    "time_send_partner": "2024-01-01T00:00:00Z",
    "charged_by_kredivo": 1,
    "discount": 1,
    "histories": [],
    "duplicated_customer": true,
    "tax": 1,
    "is_from_ecommerce": true,
    "note_image": [
      "https://statics.pancake.vn/user-content.pancake.vn/2021/8/5/fccd6.jpg"
    ],
    "shopify_draft_order_id": null,
    "display_id": 1,
    "shop_partner_id": 1,
    "is_locked": true
  },
  "returned_items": [
    {
      "id": 1,
      "product_id": "3487e126-b0d9-4dae-89a9-ee60bef2f4e9",
      "variation_id": "415040f4-ab63-465e-8699-e9ebfff4c6c7",
      "returned_quantity": 1,
      "discount_each_product": 1,
      "is_discount_percent": true
    }
  ],
  "returned_fee": 1,
  "shop_customer_id": "96a8e283-3fba-492e-a35a-970f72a30a02",
  "shop_id": 1,
  "status": 1,
  "status_histories": [
    {
      "id": 1,
      "editor_id": "8fbe2a6f-b0b2-4227-a698-19d18c43f7c8",
      "old_status": 0,
      "status": 1,
      "inserted_at": "2024-01-01T00:00:00Z",
      "updated_at": "2024-01-01T00:00:00Z"
    }
  ],
  "tags": [
    1
  ],
  "warehouse_id": "b4cb5897-6e56-4581-96cc-2f12677c7bd8"
}
```

## Danh sách đối tác

`GET /shops/{SHOP_ID}/partners`

Lấy danh sách đối tác vận chuyển

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |

### Phản hồi

- `200` Success (object)

```json
{
  "data": [
    {
      "id": 1,
      "name": "Giao hàng tiết kiệm",
      "country_code": "84",
      "accounts": [
        {
          "id": 46036,
          "name": "sonvu8910-224"
        }
      ]
    },
    {
      "id": 2,
      "name": "EMS",
      "country_code": "84",
      "accounts": []
    },
    {
      "id": 3,
      "name": "VTP",
      "country_code": "84",
      "accounts": [
        {
          "id": 10932,
          "name": "hà an"
        }
      ]
    },
    {
      "id": 4,
      "name": "247 Express",
      "country_code": "84",
      "accounts": []
    }
  ],
  "success": true
}
```

## Danh sách dự án

`GET /shops/{SHOP_ID}/projects`

Lấy danh sách dự án

### Tham số

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `SHOP_ID` | path | integer | yes | Mã shop |

### Phản hồi

- `200` Success (Project)

```json
{
  "data": [
    {
      "id": 19,
      "image": null,
      "inserted_at": "2025-12-13T10:01:51",
      "name": "Project 1",
      "nodes": [
        {
          "custom_id": null,
          "id": 292,
          "image": null,
          "inserted_at": "2024-03-28T04:52:28",
          "link_source_id": null,
          "name": "Source order 1",
          "nodes": [
            {
              "custom_id": null,
              "id": 366,
              "image": null,
              "inserted_at": "2024-11-08T02:18:52",
              "link_source_id": null,
              "name": "Source order 2",
              "nodes": [],
              "parent_id": 292,
              "project_id": null,
              "shop_id": 20,
              "updated_at": "2025-07-02T02:52:14"
            }
          ],
          "parent_id": null,
          "project_id": 19,
          "shop_id": 20,
          "updated_at": "2025-12-13T10:02:02"
        }
      ],
      "shop_id": 20,
      "updated_at": "2025-12-13T10:01:51"
    }
  ],
  "success": true
}
```
