Giữ đơn, nhả giữ và huỷ ship
Dành cho chăm sóc khách hàng: giữ (hold) một đơn trong lúc người mua quyết định, rồi nhả giữ (release) hoặc huỷ. Ba route này áp dụng cho đơn từ mọi nguồn của store, giống các nút Hold / Resume / Cancel trong app seller, và trả về cùng một dạng: data = {order_id, order_number, order_code, result, hold, cancel_kind, refund_amount, items, cs_hold}.
Đơn đang ở giai đoạn nào: cs_hold
GET /orders/query.json và mọi response của các route này đều có cs_hold:
{
"stage": "on_hold",
"production_started": false,
"can_hold": true,
"can_cancel": true,
"cancel_kind": "cancel",
"hold": {
"id": "27932d01-3f3d-4324-ad61-8c7ccfcba7a0",
"reason": "design",
"reason_label": "Chờ khách xác nhận thiết kế / ảnh",
"note": "Buyer is sending a new photo",
"source": "cs-hub",
"requested_by": "[email protected]",
"reference": "CS-1234",
"until": "2026-11-20T00:00:00Z",
"held_at": "2026-11-10T11:55:35.883986Z",
"released_at": null
}
}| Key | |
|---|---|
stage | pre_production (chưa trừ tiền), on_hold, error, fulfilling (đã trừ tiền, chưa sản xuất), in_production, shipped, cancelled, external, unknown |
can_hold | Có thể giữ đơn ngay lúc này (đơn chưa bị trừ tiền). |
production_started | Item đang hoặc đã được sản xuất. |
can_cancel, cancel_kind | Cancel-ship lúc này có dùng được không, và sẽ làm gì: cancel (chưa sản xuất gì), cancel-produce (dừng sản xuất), cancel-ship (đã làm xong, sẽ không ship). |
hold | Lần giữ đơn đang mở của bạn, hoặc null. |
Luồng gợi ý: can_hold → cho phép Hold; nếu không thì can_cancel → cho phép Cancel (cancel_kind cho biết sẽ mất gì); nếu không nữa thì đơn đã ship và không làm gì được trong Pawdo.
Giữ đơn (hold)
POST {base_url}/api/integration/orders/hold.json
| Field | ||
|---|---|---|
order_id hoặc order_number | bắt buộc một trong hai | order_number được thử đúng như gửi, rồi thử có / không có dấu # ở đầu. |
reason | bắt buộc | design, variant, cancel, address, other, check, customer, agency, leader |
note | ≤ 2000 | |
requested_by | ≤ 255 | Ai yêu cầu (chữ tự do). |
reference | ≤ 64 | Mã ticket của bạn. |
until | RFC 3339 | Thời điểm bạn dự kiến nhả giữ. Chỉ để tham khảo: Pawdo không bao giờ tự nhả giữ. |
source | ≤ 32 | Nhãn hệ thống của bạn; mặc định cs-hub. |
curl -X POST "{base_url}/api/integration/orders/hold.json" \
-H "X-pawdo-access-token: $PAWDO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"order_number": "DOCS-185527-H", "reason": "design", "note": "Buyer is sending a new photo", "requested_by": "[email protected]", "reference": "CS-1234", "until": "2026-11-20T00:00:00Z"}'{
"data": {
"order_id": "5cd24b56-a3f5-4d71-8105-61c5188cd24e",
"order_number": "DOCS-185527-H",
"order_code": "PD290-9320",
"result": "held",
"hold": {
"id": "27932d01-3f3d-4324-ad61-8c7ccfcba7a0",
"reason": "design",
"reason_label": "Chờ khách xác nhận thiết kế / ảnh",
"note": "Buyer is sending a new photo",
"source": "cs-hub",
"requested_by": "[email protected]",
"reference": "CS-1234",
"until": "2026-11-20T00:00:00Z",
"held_at": "2026-11-10T11:55:35.883986163Z",
"released_at": null
},
"cs_hold": {
"stage": "on_hold",
"production_started": false,
"can_hold": true,
"can_cancel": true,
"cancel_kind": "cancel",
"hold": {
"id": "27932d01-3f3d-4324-ad61-8c7ccfcba7a0",
"reason": "design",
"reason_label": "Chờ khách xác nhận thiết kế / ảnh",
"note": "Buyer is sending a new photo",
"source": "cs-hub",
"requested_by": "[email protected]",
"reference": "CS-1234",
"until": "2026-11-20T00:00:00Z",
"held_at": "2026-11-10T11:55:35.883986Z",
"released_at": null
}
}
},
"message": "order on hold",
"status": true
}Giữ một đơn đang bị giữ sẽ trả result: already_held và giữ nguyên lý do đầu tiên. Đơn đã bị trừ tiền thì không giữ được — lỗi 409 kèm cs_hold, và cách xử lý là cancel-ship:
{
"data": {
"order_id": "6321be4b-5079-4dbb-9d56-52a997129efc",
"order_number": "#1002",
"order_code": "PD290-9249",
"hold": null,
"cs_hold": {
"stage": "in_production",
"production_started": true,
"can_hold": false,
"can_cancel": true,
"cancel_kind": "cancel-produce",
"hold": null
}
},
"error_code": "ALREADY_IN_PRODUCTION",
"message": "the order is in production; it can no longer be held, only cancelled (cancel-ship)",
"status": false
}Nhả giữ (release)
POST {base_url}/api/integration/orders/release.json
| Field | ||
|---|---|---|
order_id hoặc order_number | bắt buộc một trong hai | |
outcome | bắt buộc | continue, changed hoặc cancel |
note, requested_by |
outcome | Pawdo làm gì | result |
|---|---|---|
continue / changed | Chạy tiếp đơn và xác thực lại; đơn được trừ tiền theo lịch. | resumed |
continue / changed, có người trong Pawdo cũng đang giữ đơn | Đóng lần giữ của bạn; đơn vẫn bị giữ. | released_kept |
continue / changed, Pawdo đã gỡ giữ trước đó | Đóng lần giữ của bạn. | released_not_held |
cancel | Đóng lần giữ và huỷ đơn, như cancel-ship. | cancelled |
changed nghĩa là thay đổi của người mua đã được thực hiện trong Pawdo trước khi nhả giữ — bằng PATCH /orders/{id}.json với đơn tạo qua API, hoặc trong app seller. Nhả giữ thêm lần nữa trả already_released.
curl -X POST "{base_url}/api/integration/orders/release.json" \
-H "X-pawdo-access-token: $PAWDO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"order_id": "5cd24b56-a3f5-4d71-8105-61c5188cd24e", "outcome": "continue", "note": "Buyer kept the design", "requested_by": "[email protected]"}'{
"data": {
"order_id": "5cd24b56-a3f5-4d71-8105-61c5188cd24e",
"order_number": "DOCS-185527-H",
"order_code": "PD290-9320",
"result": "resumed",
"hold": {
"id": "27932d01-3f3d-4324-ad61-8c7ccfcba7a0",
"reason": "design",
"reason_label": "Chờ khách xác nhận thiết kế / ảnh",
"note": "Buyer is sending a new photo",
"source": "cs-hub",
"requested_by": "[email protected]",
"reference": "CS-1234",
"until": "2026-11-20T00:00:00Z",
"held_at": "2026-11-10T11:55:35.883986Z",
"released_at": "2026-11-10T11:55:35.920654194Z",
"release_outcome": "continue",
"release_note": "Buyer kept the design",
"released_by": "[email protected]"
},
"cs_hold": {
"stage": "pre_production",
"production_started": false,
"can_hold": true,
"can_cancel": true,
"cancel_kind": "cancel",
"hold": null
}
},
"message": "hold released",
"status": true
}Huỷ ship (cancel-ship)
POST {base_url}/api/integration/orders/cancel-ship.json
Huỷ bất kỳ đơn nào của store chưa được bàn giao cho hãng vận chuyển: Pawdo sẽ không giao đơn và hoàn phí fulfillment vào số dư của store — kể cả các item đã sản xuất.
| Field | ||
|---|---|---|
order_id hoặc order_number | bắt buộc một trong hai | |
reason | bắt buộc | Cùng các giá trị như hold. |
note, requested_by, reference |
curl -X POST "{base_url}/api/integration/orders/cancel-ship.json" \
-H "X-pawdo-access-token: $PAWDO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"order_id": "a2b05603-3d78-470f-bd3e-8bbe9f88acaa", "reason": "cancel", "requested_by": "[email protected]"}'{
"data": {
"order_id": "a2b05603-3d78-470f-bd3e-8bbe9f88acaa",
"order_number": "#1004",
"order_code": "PD290-9313",
"result": "cancelled",
"hold": null,
"cancel_kind": "cancel-produce",
"refund_amount": 20,
"items": [
{
"id": "05e9c08d-3fe9-4cc4-9a77-4f429c5511d0",
"print_code": 2572833,
"sku": "SOC-M",
"status": "cancel-produce",
"cancelled_at": "2026-11-10T11:55:36.326938Z"
},
{
"id": "2a8cf2ca-447c-460a-a353-e23e1f06ceca",
"print_code": 2572834,
"sku": "GP-L1",
"status": "cancel-produce",
"cancelled_at": "2026-11-10T11:55:36.326938Z"
}
],
"cs_hold": {
"stage": "cancelled",
"production_started": false,
"can_hold": false,
"can_cancel": false,
"cancel_kind": "",
"hold": null
}
},
"message": "order cancelled",
"status": true
}cancel_kind là việc đã làm; refund_amount là số tiền đã hoàn (không có khi chưa trừ tiền gì); items là từng đơn vị kèm trạng thái mới — cancel-produce (sẽ không sản xuất) hoặc cancel-ship (đã làm xong, sẽ không ship). Gọi lại trả already_cancelled và không hoàn thêm tiền.
Lỗi của ba route
| HTTP | error_code | Khi nào | data |
|---|---|---|---|
| 400 | BAD_REQUEST | Body không phải JSON | |
| 404 | ORDER_NOT_FOUND | Store không có đơn này | |
| 409 | ALREADY_IN_PRODUCTION | Hold: đơn đã bị trừ tiền hoặc đang sản xuất | cs_hold |
| 409 | ALREADY_SHIPPED | Hold hoặc cancel: đã bàn giao cho hãng vận chuyển | cs_hold |
| 409 | ORDER_CANCELLED | Hold: đơn đã bị huỷ | cs_hold |
| 409 | ORDER_EXTERNAL | Đơn được fulfill ngoài Pawdo | cs_hold |
| 409 | NOT_HOLDABLE | Hold: đơn đang ở error | cs_hold |
| 409 | NOT_ON_HOLD | Release: bạn chưa từng giữ đơn này | cs_hold |
| 409 | ORDER_BUSY | Cancel: đơn đang được gửi sang sản xuất — thử lại sau một phút | cs_hold |
| 409 | NOT_CANCELLABLE | Cancel: bị từ chối ở giai đoạn này | cs_hold |
| 409 | AMBIGUOUS_ORDER | order_number khớp nhiều đơn — hãy gửi order_id | order_ids |
| 422 | VALIDATION_FAILED | Thiếu field hoặc field không hợp lệ, ví dụ validation failed: reason must be one of [design variant cancel address other check customer agency leader] | |
| 422 | NO_STORE_OWNER | Store không có tài khoản chủ để thực hiện việc huỷ — liên hệ Pawdo | |
| 500 | Chưa có gì được ghi. Gửi lại an toàn. |
Nếu có bất kỳ vấn đề nào liên quan đến API, vui lòng liên hệ bộ phận support của Pawdo qua Facebook để được hỗ trợ.