Skip to main content

Phiếu trả hàng

Mô tả​

Các API hỗ trợ:

API​


GET /api/orderReturnTickets​

Danh sách phiếu trả hàng:

Tham số query:

Tên trườngKiểu dữ liệuMô tảBắt buộc
codestringMã phiếuKhông
order_codestringMã đơnKhông
customerstringTên hoặc số điện thoại kháchKhông
refund_methodstringcash hoặc bank_transferKhông
reason_keystringLý do trảKhông
created_fromstringyyyy-MM-dd'T'HH:mm:ssKhông
created_tostringyyyy-MM-dd'T'HH:mm:ssKhông
pageintegerTrangKhông
sizeintegerSố bản ghi trên trangKhông
sortstringTên trường sắp xếpKhông
orderstringasc / descKhô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ườngKiểu dữ liệuMô tảBắt buộc
codestringMã phiếu (tối đa 30)Không
warehouse_idstringKho nhận hàng trảCó
reason_keystringdefective | wrong_size | changed_mind | wrong_delivery | otherCó
reason_notestringBắt buộc khi reason_key là otherKhông
refund_methodstringcash hoặc bank_transferCó
bank_namestringBắt buộc khi chuyển khoảnKhông
bank_binstringBắt buộc khi chuyển khoảnKhông
bank_account_numberstringBắt buộc khi chuyển khoảnKhông
bank_account_holderstringBắt buộc khi chuyển khoảnKhông
transaction_codestringMã giao dịchKhông
return_feenumberPhí trả, >= 0Có
notestringGhi chú (tối đa 500)Không
returned_atstringNgày trảKhông
itemsobject[]Dòng trảCó
items[].inventory_idstringId tồn khoCó
items[].order_idstringId đơnCó
items[].order_detail_idstringId dòng đơnCó
items[].order_detail_item_idstringId serial/RFID của dòngCó

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"
}
}