以 SKU 建立 Resend
Enterprise-only. Creates a resend by supplying warehouse-scoped SKU quantities instead of explicit return inventory IDs. The service selects eligible pending return inventory records itself (LIFO by default), then reuses the standard create-resend workflow. The whole request is processed atomically — either every requested unit is allocated and one resend is created, or nothing is.
何時使用本端點,而非 Create resend order
- 當您以 SKU 與數量追蹤庫存、且不想管理個別
returnInventoryId值時,使用以 SKU 建立 Resend。 - 當您已握有想補寄的特定
returnInventoryId值(例如從newInventoryCreatedwebhook 快取而來)時,使用 Create resend order。
前置條件
- 您的帳戶已啟用 SKU 庫存模組(Enterprise)。
- 該倉庫中每個請求的 SKU 都有足夠、符合補寄資格的庫存。請先以 搜尋 SKU 庫存(
availableQuantity)確認彙總量,但請注意通過彙總檢查並非保證——見下文。 shipmentServiceType是 Shipment Service Type(不是 Return Service Type)。有效代碼請見 取得 Warehouse 可用的 Shipment Service Types。
挑選機制
配置分三個階段,且只有最後一個階段具權威性:- 驗證。 您的請求行會被正規化(SKU trim + 轉大寫),重複的 SKU 會被合併。驗證會依
warehouseId+ 正規化後 SKU 檢查availableQuantity。通過此檢查僅代表彙總量看起來足夠——不會保留或配置任何東西。 - 挑選。 系統查詢符合您
warehouseId與正規化 SKU 且具補寄資格的實際退件庫存記錄,再依挑貨策略恰好挑出所請求的數量。若符合資格的記錄少於請求量,整筆請求會被拒絕。 - 配置。 在交易內,將被挑選的列加鎖並重新檢查;若有任何一列不再符合資格,交易回滾且請求失敗。否則所有被挑選的記錄會被推進至 resend / in-progress,並在同一交易內建立補寄。
資格規則
退件庫存記錄唯有在符合以下條件時才可被挑選:- 符合請求的
warehouseId與正規化後 SKU; handlingStatusCode= pending;- 可轉換至 resend / in-progress;且
- 無待處理 VAS,包含任何未完成的 VAS Split。
availableQuantity(後者仍可能計入帶待處理 VAS 的記錄)。當發生此情況時,請求會以 fail-closed 方式失敗,而非補寄不符資格的項目。
挑貨策略
挑選預設採 LIFO:最新createOn 優先,並以最大的退件庫存 ID 作為決勝依據。此策略置於工廠(factory)之後,未來可切換為 FIFO 而不需更動配置邏輯。
錯誤與重試
- 驗證失敗會以 HTTP 200 搭配
meta.status: 400回傳(標準的軟錯誤封套——見錯誤處理)。 - 當某個 SKU 可用量不足時,會整筆拒絕請求。基於安全考量,錯誤不會揭露剩餘可用量。
- 當並行請求爭用相同庫存時,未能鎖定記錄的請求會被拒絕,並可重試。
相關
- 搜尋 SKU 庫存 — 在請求前確認
availableQuantity。 - Create resend order — 以明確的退件庫存 ID 補寄;亦涵蓋面單產生(自動 vs 手動服務類型)與取消截止時間,這些同樣適用於此處建立的補寄。
- 取消補寄訂單 — 在倉庫出貨前中止。
- Webhooks — resend-status-update 事件會將生命週期變更推送至您的端點。
授權
Your API key
Your API token — keep this private
主體
Create a resend by warehouse-scoped SKU quantities. companyName is not part of this request.
Warehouse to fulfil the resend from. Must be greater than 0 and owned by the authenticated account. All selected inventory comes from this single warehouse.
Shipment service type code (not a return service type). Non-others values are validated against the available shipment service and service zone for the warehouse and destination.
Non-empty list of SKU + quantity lines. The number of raw lines is limited to 100; the combined quantity across all lines is limited to 100.
Destination address for the resend shipment.
Optional seller reference number. When provided, 1-50 characters with no invisible characters. Stored on the created resend shipment and echoed back in the response.
50Optional free-text description for the resend order.
Optional free-text merchant remarks for the resend order.
Optional free-text remarks addressed to the warehouse.
回應
Success
Wraps CreateResendBySkuReply under data, alongside the standard correlationId and meta envelope.
Create resend by SKU result.