HomeGuidesAPI ReferenceChangelogDiscussions
HomeLog In
Guides

Get Archived Orders

📘

Get Archived Orders 使用場景

SHOPLINE 將依據訂單狀態封存超過一定期限的訂單資料,因此當使用 Get OrderGet 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

ParameterTypeDescriptionExample
filtersString匯出冷區報表開始時間filters: {
start_date: "2024-07-29T16:00:00.000Z",
end_date: "2024-07-31T16:00:00.000Z"
}
callback_urlString當 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

ParameterTypeDescriptionExample
messageArrayJob 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

ParameterTypeDescriptionExample
topicStringEvent topic nameorder/get_archived_order
job_idStringJob Identifier
merchant_idStringMerchant Identifier
merchant_handleString
start_dateDateTime匯出冷區報表開始時間
end_dateDateTime匯出冷區報表結束時間
download_links[]String若干 S3 下載連結
statusString產報表的結果success, failed
error_messageString當產報表的結果為 failed 時的 error
eventString事件所屬的資源分類Order
callback_urlString當 job 完成後會呼叫的 callback URL
application_idString使用 application token 時,所屬的 application id

CSV Fields

csv 範例檔案請參考 csv sample file,可取用的欄位資訊說明如下:

ParameterTypeDescriptionExample
idStringOrder ID
訂單ID
5d8c8b3be388095d25acbc89
order_numberStringOrder Number
訂單號碼
2019052707260498
system_order_numberString系统生成的訂單號
merchant_order_numberString店家自定義訂單號
(會根據rollout_key選擇用哪個order_number)
statusStringOrder Status
訂單狀態

- Status allows
pending 處理中
confirmed 已確認
completed 已完成
cancelled 已取消
pending
typeStringPOS Order Type
POS 訂單類型

- general 一般訂單
preorder 預訂單
exchange 換貨單
return 退貨單
preorder
order_remarksStringOrder Remarks
訂單備註
Please send the goods after 4p.m.
order_paymentOrderPaymentOrder Payment Information
付款資訊
Please check the link on the left
order_deliveryOrderDeliveryOrder Delivery Information
送貨資訊
Please check the link on the left
delivery_addressOrder DeliveryAddressRecipient Information
收件人基本資訊
Please check the link on the left
delivery_dataOrder DeliveryDataThird-Party Delivery Information
第三方串接物流資訊
Please check the link on the left
cart_page_idStringCart Page ID
一頁式商店 ID
628604a1e388091b6fd29836
customer_idStringCutomer ID
顧客ID
5cc17da1e388091b6fd299ed
customer_nameStringCustomer's Name
顧客姓名
郭美玉
customer_emailStringCustomer's Email
顧客Email
[email protected]
customer_phoneStringCustomer's Phone
顧客電話
0912345678
customer_phone_country_codeStringCustomer's Phone Country Code
顧客電話國碼
886
customer_infoOrder CustomerInfoCustomer's Information
顧客其他基本資訊
Please check the link on the left
currency_isoStringCurrency ISO (ISO-4217)
ISO 4217 貨幣代碼
TWD
subtotalMoneyPrice total for all order items
訂單小計,包含商品總價
Please check the link on the left
order_discountMoney Order discount
優惠折扣
Please check the link on the left
user_creditMoney Customer Credit
折抵購物金
Please check the link on the left
total_tax_feeMoney Total Tax Fee
訂單稅費
Please check the link on the left
totalMoney Final price total, which includes payment fee and delivery fee
付款總金額,包含附加費與運費
Please check the link on the left
order_pointsIntegerPoints used
會員點數使用
15
order_points_to_cashMoney Points used to cash
會員點數轉現金
Please check the link on the left
invoiceOrder InvoiceInvoice Info
訂單現在的發票資訊
Please check the link on the left
invoicesArrayInvoices Info
訂單所有開立過的發票(包含作廢)
內容可參考 Invoice
subtotal_itemsOrder Subtotal_itemsOrder Product Item Data
訂單商品資訊
Please check the link on the left
promotion_itemsOrder Promotion_itemsPromotion Item Data
訂單折扣資訊
Please check the link on the left
custom_dataArrayCustomized Order Fields
客製化欄位

- *欲使用此欄位請先至商店後台>訂單設定>自訂訂單欄位 進行設定
[{"value": "優質的店家!", "field_translations": {
"zh-hant": "想對老闆說的話"
},
"field_id": "5c404ef1e3880922e57856a6"}]
custom_discount_itemsOrder ItemOrder Custom Discount Item DataPlease check the link on the left
affiliate_dataObjectLive stream room data
ref_order_idString直播間資料For third party custom order id
可供儲存第三方訂單ID
ORD0001
ref_customer_idStringFor third party custom customer id
可供儲存第三方顧客ID
CUS0001
agentOrder Agent## 員工資料*只供POS商户使用Please check the link on the left
parent_order_idStringParent Order ID
拆單後之母訂單ID
split_atDateTimeOrder Split Time
拆單時間
confirmed_atDateTimeOrder Confirmed Time
訂單確認時間
(如尚未確認則顯示null)

- *UTC Time
updated_atDateTimeOrder Updated Time
訂單更新時間

- *UTC TimeNote: (2024/03/01 更新)
目前已知有些物流狀態更新時,不會更新此欄位時間,建議如果要追蹤物流更新時間,可以參考 order_delivery. updated_at欄位
2019-09-26
T09:56:16.803+00:00
created_atDateTimeOrder Created Time
訂單創造日期

- *UTC Time
2019-09-26
T09:56:11.924+00:00
edited_atDateTime"Order edited Time
訂單編輯日期

- *UTC Time"
skip_fulfillmentBooleanIs order skipping fulfillment?
訂單是否略過“扣減庫存”
false
utm_dataUTM DataUTM Data
UTM參數
Please check the link on the left
ga_trackedBooleanIs tracked by GA?
是否使用GA追蹤
false
created_byStringChannel 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_fromStringOrder created from
訂單成立於
(訂單成立的位置,包含
前台購物網站/一頁式商店​​​​/後台系統/OpenAPI…等等)

- 需開通訂單來源功能*Feature key: order_new_source (開通後才能於 Admin 後台看到這個值對應的顯示)
admin_openapi
is_guest_checkoutBooleantrue checkout as guest
false checkout as login user
affiliate_campaign ObjectAffiliate campaign associated with the order
訂單對應的推薦活動
order_sourceObjectSource of the order
訂單來源
(訂單的來源,包含
紛絲專頁名稱/LINE/shopee/門市名稱…)

- *Feature key: order_new_source (開通訂單來源功能後才能於 Admin 後台看到這個值對應的顯示)
tagsArrayAll tag content of the order
訂單所有標籤內容
return_from_order_idStringOriginal POS order id from POS return order
POS 退貨單的原始訂單 ID
agent_idStringAgent id that created the order
代理建立訂單的操作者 ID
633fb52fd87b66000b180726
credit_reward_campaign_summaryObjectCredit reward campaign with the order
訂單回饋活動摘要

適用情況:有開啟「回饋活動」featureKey= credit_campaign 功能時。
member_point_summaryObjectmember point with the order
訂單可獲得的點數資訊
cart_attributesObjectSnapshot of cart
購物車快照
checkout_object_dataObjectSummary of cart
購物車摘要
membership_tier_dataObjectSnapshot of MembershipTier
會員等級快照
product_subscription_periodIntegerProduct subscription period
定期購期數