Get Archived Orders
Get Archived Orders 使用場景
SHOPLINE 將依據訂單狀態封存超過一定期限的訂單資料,因此當使用
Get Order
、Get Orders
抓取訂單資料,訂單資料標示如下時,則表示該訂單已封存,則需透過Get Archived Orders
取得訂單資料
- Get Order - 收到 410 response (請參閱 Get Order)
- Get Orders - response 中標註已封存訂單 (請參閱 Get Orders)
Function
To search archived orders with specific conditions.
利用條件搜尋冷區訂單,並且透過 Webhook 方式通知。
由於冷區匯出所需要的時間比較長,以下 API 會使用非同步的形式設計。
詳情可以參考流程圖
Sequence Diagram
Required API Auth
Get Archived Order
URL
POST <https://open.shopline.io/v1/orders/archived_orders>
Request Parameter
Parameter | Type | Description | Example |
---|---|---|---|
filters | String | 匯出冷區報表開始時間 | filters: { start_date: "2024-07-29T16:00:00.000Z", end_date: "2024-07-31T16:00:00.000Z" } |
callback_url | String | 當 job 完成後會呼叫的 callback URL |
Callback_url 驗證
當封存訂單處理完成後,將透過 webhook 發送 Callback parameter 至對應的 callback_url。為確保 callback_url 正確性將會進行驗證,詳請參閱 Webhook Verification
Request example
curl -X POST https://open.shopline.io/v1/orders/archived_orders \
-H "Content-Type: application/json" \
-d '{
"filters": {
"start_date": "2024-07-29T16:00:00.000Z",
"end_date": "2024-07-31T16:00:00.000Z"
},
"callback_url": "http://your-callback-url.com"
}'
Response fields
Parameter | Type | Description | Example |
---|---|---|---|
message | Array | Job Identifier info |
Response example
{
"message": [
{
"job_id": "66716227f0216707b1b9eaaa",
"start_date": "2024-07-29T16:00:00.000Z",
"end_date": "2024-07-31T16:00:00.000Z"
},
{
"job_id": "66716227f0216707b1b9eabc",
"start_date": "2024-07-31T16:00:00.000Z",
"end_date": "2024-08-31T16:00:00.000Z"
}
]
}
Callback Method
We will use post method
Callback parameter
Parameter | Type | Description | Example |
---|---|---|---|
topic | String | Event topic name | order/get_archived_order |
job_id | String | Job Identifier | |
merchant_id | String | Merchant Identifier | |
merchant_handle | String | ||
start_date | DateTime | 匯出冷區報表開始時間 | |
end_date | DateTime | 匯出冷區報表結束時間 | |
download_links | []String | 若干 S3 下載連結 | |
status | String | 產報表的結果 | success, failed |
error_message | String | 當產報表的結果為 failed 時的 error | |
event | String | 事件所屬的資源分類 | Order |
callback_url | String | 當 job 完成後會呼叫的 callback URL | |
application_id | String | 使用 application token 時,所屬的 application id |
CSV Fields
csv 範例檔案請參考 csv sample file,可取用的欄位資訊說明如下:
Parameter | Type | Description | Example |
---|---|---|---|
id | String | Order ID 訂單ID | 5d8c8b3be388095d25acbc89 |
order_number | String | Order Number 訂單號碼 | 2019052707260498 |
system_order_number | String | 系统生成的訂單號 | |
merchant_order_number | String | 店家自定義訂單號 (會根據rollout_key選擇用哪個order_number) | |
status | String | Order Status 訂單狀態 - Status allows pending 處理中 confirmed 已確認 completed 已完成 cancelled 已取消 | pending |
type | String | POS Order Type POS 訂單類型 - general 一般訂單 preorder 預訂單 exchange 換貨單 return 退貨單 | preorder |
order_remarks | String | Order Remarks 訂單備註 | Please send the goods after 4p.m. |
order_payment | OrderPayment | Order Payment Information 付款資訊 | Please check the link on the left |
order_delivery | OrderDelivery | Order Delivery Information 送貨資訊 | Please check the link on the left |
delivery_address | Order DeliveryAddress | Recipient Information 收件人基本資訊 | Please check the link on the left |
delivery_data | Order DeliveryData | Third-Party Delivery Information 第三方串接物流資訊 | Please check the link on the left |
cart_page_id | String | Cart Page ID 一頁式商店 ID | 628604a1e388091b6fd29836 |
customer_id | String | Cutomer ID 顧客ID | 5cc17da1e388091b6fd299ed |
customer_name | String | Customer's Name 顧客姓名 | 郭美玉 |
customer_email | String | Customer's Email 顧客Email | [email protected] |
customer_phone | String | Customer's Phone 顧客電話 | 0912345678 |
customer_phone_country_code | String | Customer's Phone Country Code 顧客電話國碼 | 886 |
customer_info | Order CustomerInfo | Customer's Information 顧客其他基本資訊 | Please check the link on the left |
currency_iso | String | Currency ISO (ISO-4217) ISO 4217 貨幣代碼 | TWD |
subtotal | Money | Price total for all order items 訂單小計,包含商品總價 | Please check the link on the left |
order_discount | Money | Order discount 優惠折扣 | Please check the link on the left |
user_credit | Money | Customer Credit 折抵購物金 | Please check the link on the left |
total_tax_fee | Money | Total Tax Fee 訂單稅費 | Please check the link on the left |
total | Money | Final price total, which includes payment fee and delivery fee 付款總金額,包含附加費與運費 | Please check the link on the left |
order_points | Integer | Points used 會員點數使用 | 15 |
order_points_to_cash | Money | Points used to cash 會員點數轉現金 | Please check the link on the left |
invoice | Order Invoice | Invoice Info 訂單現在的發票資訊 | Please check the link on the left |
invoices | Array | Invoices Info 訂單所有開立過的發票(包含作廢) | 內容可參考 Invoice |
subtotal_items | Order Subtotal_items | Order Product Item Data 訂單商品資訊 | Please check the link on the left |
promotion_items | Order Promotion_items | Promotion Item Data 訂單折扣資訊 | Please check the link on the left |
custom_data | Array | Customized Order Fields 客製化欄位 - *欲使用此欄位請先至商店後台>訂單設定>自訂訂單欄位 進行設定 | [{"value": "優質的店家!", "field_translations": { "zh-hant": "想對老闆說的話" }, "field_id": "5c404ef1e3880922e57856a6"}] |
custom_discount_items | Order Item | Order Custom Discount Item Data | Please check the link on the left |
affiliate_data | Object | Live stream room data | |
ref_order_id | String | 直播間資料For third party custom order id 可供儲存第三方訂單ID | ORD0001 |
ref_customer_id | String | For third party custom customer id 可供儲存第三方顧客ID | CUS0001 |
agent | Order Agent | ## 員工資料*只供POS商户使用 | Please check the link on the left |
parent_order_id | String | Parent Order ID 拆單後之母訂單ID | |
split_at | DateTime | Order Split Time 拆單時間 | |
confirmed_at | DateTime | Order Confirmed Time 訂單確認時間 (如尚未確認則顯示null) - *UTC Time | |
updated_at | DateTime | Order Updated Time 訂單更新時間 - *UTC TimeNote: (2024/03/01 更新) 目前已知有些物流狀態更新時,不會更新此欄位時間,建議如果要追蹤物流更新時間,可以參考 order_delivery. updated_at欄位 | 2019-09-26 T09:56:16.803+00:00 |
created_at | DateTime | Order Created Time 訂單創造日期 - *UTC Time | 2019-09-26 T09:56:11.924+00:00 |
edited_at | DateTime | "Order edited Time 訂單編輯日期 - *UTC Time" | |
skip_fulfillment | Boolean | Is order skipping fulfillment? 訂單是否略過“扣減庫存” | false |
utm_data | UTM Data | UTM Data UTM參數 | Please check the link on the left |
ga_tracked | Boolean | Is tracked by GA? 是否使用GA追蹤 | false |
created_by | String | Channel that created the order 建立訂單的渠道 - openapi Open API Create Order 建立 admin Admin 後台 - 手動建立 shop 前台購物網站 shop_crm SmartOMO 建立 pos 實體店 POS sc 後台-直播中心 mc 後台-訊息中心 import 匯入訂單 sc_manual_order 創建訂單-社交電商 post 後台-貼文銷售 | openapi |
created_from | String | Order created from 訂單成立於 (訂單成立的位置,包含 前台購物網站/一頁式商店/後台系統/OpenAPI…等等) - 需開通訂單來源功能*Feature key: order_new_source (開通後才能於 Admin 後台看到這個值對應的顯示) | admin_openapi |
is_guest_checkout | Boolean | true checkout as guest false checkout as login user | |
affiliate_campaign | Object | Affiliate campaign associated with the order 訂單對應的推薦活動 | |
order_source | Object | Source of the order 訂單來源 (訂單的來源,包含 紛絲專頁名稱/LINE/shopee/門市名稱…) - *Feature key: order_new_source (開通訂單來源功能後才能於 Admin 後台看到這個值對應的顯示) | |
tags | Array | All tag content of the order 訂單所有標籤內容 | |
return_from_order_id | String | Original POS order id from POS return order POS 退貨單的原始訂單 ID | |
agent_id | String | Agent id that created the order 代理建立訂單的操作者 ID | 633fb52fd87b66000b180726 |
credit_reward_campaign_summary | Object | Credit reward campaign with the order 訂單回饋活動摘要 適用情況:有開啟「回饋活動」featureKey= credit_campaign 功能時。 | |
member_point_summary | Object | member point with the order 訂單可獲得的點數資訊 | |
cart_attributes | Object | Snapshot of cart 購物車快照 | |
checkout_object_data | Object | Summary of cart 購物車摘要 | |
membership_tier_data | Object | Snapshot of MembershipTier 會員等級快照 | |
product_subscription_period | Integer | Product subscription period 定期購期數 |
Updated 2 months ago