Phiếu trả hàng
Mô tả
Các API hỗ trợ:
- GET /orderReturnTickets: Danh sách
- GET /orderReturnTickets/{id}: Chi tiết
- POST /orderReturnTickets: Tạo
API
GET /api/orderReturnTickets
Danh sách phiếu trả hàng:
Tham số query:
| Tên trường | Kiểu dữ liệu | Mô tả | Bắt buộc |
|---|---|---|---|
code | string | Mã phiếu | Không |
order_code | string | Mã đơn | Không |
customer | string | Tên hoặc số điện thoại khách | Không |
refund_method | string | cash hoặc bank_transfer | Không |
reason_key | string | Lý do trả | Không |
created_from | string | yyyy-MM-dd'T'HH:mm:ss | Không |
created_to | string | yyyy-MM-dd'T'HH:mm:ss | Không |
page | integer | Trang | Không |
size | integer | Số bản ghi trên trang | Không |
sort | string | Tên trường sắp xếp | Không |
order | string | asc / desc | Không |
GET /api/orderReturnTickets?page=1&size=10
result: id, code, order_id, order_code, customer_id, customer_name, customer_phone_number, warehouse_id, warehouse_name, reason_key, reason_note, note, returned_at, refund_method, bank_name, bank_bin, bank_account_number, bank_account_holder, transaction_code, items_amount, return_fee, refund_amount, status, item_count, created_at, created_by, updated_at, updated_by.
Response Body
{
"code": 200,
"message": "Success",
"result": [
{
"id": "{uuid}",
"code": "TH13102600000001",
"order_id": "{uuid}",
"order_code": "DH00001",
"customer_id": "{uuid}",
"customer_name": "Nguyen A",
"customer_phone_number": "0900000000",
"warehouse_id": "{uuid}",
"warehouse_name": "Kho chính",
"reason_key": "changed_mind",
"reason_note": null,
"note": null,
"returned_at": "2026-10-13",
"refund_method": "cash",
"bank_name": null,
"bank_bin": null,
"bank_account_number": null,
"bank_account_holder": null,
"transaction_code": null,
"items_amount": 500000,
"return_fee": 0,
"refund_amount": 500000,
"status": "refunded",
"item_count": 1,
"created_at": "2026-10-13T09:00:00",
"created_by": "merchant_user",
"updated_at": null,
"updated_by": null
}
],
"page": 1,
"page_size": 10,
"total": 1
}
GET /api/orderReturnTickets/{id}
Chi tiết một phiếu, kèm items.
GET /api/orderReturnTickets/\{id\}
reason_key: defective, wrong_size, changed_mind, wrong_delivery, other. refund_method: cash, bank_transfer. status: refunded.
Response Body
{
"code": 200,
"message": "Success",
"result": {
"id": "{uuid}",
"code": "TH13102600000001",
"order_id": "{uuid}",
"order_code": "DH00001",
"paid_at": "2026-10-13T09:00:00",
"order_status": 0,
"order_quantity": 1,
"order_total": 500000,
"customer_id": "{uuid}",
"customer_name": "Nguyen A",
"customer_phone_number": "0900000000",
"customer_type": "retail",
"warehouse_id": "{uuid}",
"warehouse_name": "Kho chính",
"reason_key": "changed_mind",
"reason_note": null,
"note": null,
"returned_at": "2026-10-13",
"refund_method": "cash",
"bank_name": null,
"bank_bin": null,
"bank_account_number": null,
"bank_account_holder": null,
"transaction_code": null,
"items_amount": 500000,
"return_fee": 0,
"refund_amount": 500000,
"status": "refunded",
"created_at": "2026-10-13T09:00:00",
"created_by": "merchant_user",
"updated_at": null,
"updated_by": null,
"items": [
{
"id": "{uuid}",
"ticket_id": "{uuid}",
"order_id": "{uuid}",
"order_detail_id": "{uuid}",
"order_detail_item_id": "{uuid}",
"inventory_id": "{uuid}",
"product_id": "{uuid}",
"product_detail_id": null,
"merchant_product_id": "408798",
"product_name": "Andie Shirt",
"parent_sku": "408798",
"rfid": "E280…",
"serial": 1,
"unit_price": 500000,
"thumbnail": null,
"thumbnail_url": null,
"created_at": "2026-10-13T09:00:00",
"created_by": "merchant_user",
"updated_at": null,
"updated_by": null
}
]
}
}
POST /api/orderReturnTickets
Tạo phiếu trả và hoàn tồn kho.
Request Body
| Tên trường | Kiểu dữ liệu | Mô tả | Bắt buộc |
|---|---|---|---|
code | string | Mã phiếu (tối đa 30) | Không |
warehouse_id | string | Kho nhận hàng trả | Có |
reason_key | string | defective | wrong_size | changed_mind | wrong_delivery | other | Có |
reason_note | string | Bắt buộc khi reason_key là other | Không |
refund_method | string | cash hoặc bank_transfer | Có |
bank_name | string | Bắt buộc khi chuyển khoản | Không |
bank_bin | string | Bắt buộc khi chuyển khoản | Không |
bank_account_number | string | Bắt buộc khi chuyển khoản | Không |
bank_account_holder | string | Bắt buộc khi chuyển khoản | Không |
transaction_code | string | Mã giao dịch | Không |
return_fee | number | Phí trả, >= 0 | Có |
note | string | Ghi chú (tối đa 500) | Không |
returned_at | string | Ngày trả | Không |
items | object[] | Dòng trả | Có |
items[].inventory_id | string | Id tồn kho | Có |
items[].order_id | string | Id đơn | Có |
items[].order_detail_id | string | Id dòng đơn | Có |
items[].order_detail_item_id | string | Id serial/RFID của dòng | Có |
POST /api/orderReturnTickets
Request Body
{
"warehouse_id": "{uuid}",
"reason_key": "changed_mind",
"refund_method": "cash",
"return_fee": 0,
"items": [
{
"inventory_id": "{uuid}",
"order_id": "{uuid}",
"order_detail_id": "{uuid}",
"order_detail_item_id": "{uuid}"
}
]
}
Response Body
{
"code": 200,
"message": "Success",
"result": {
"id": "{uuid}",
"code": "TH13102600000001"
}
}