文档中心 > 淘寶台灣開放平台

訂單同步教程

更新时间:2020/07/14 访问次数:392

image

訂單初始化

  • 若您一開始要將台灣淘寶中所有的商家訂單同步到您的系統,請使用 GetOrders 及 GetOrderItems 一次性的同步所有的訂單到您的系統中。
  • 台灣淘寶的訂單分為主訂單與子訂單,GetOrders 會回傳主訂單資料與其包含的子訂單號,若您在第一層顯示就想顯示子訂單項目,請以 GetOrders 回傳的子訂單號調用 GetOrderItems 來同步。
  • 訂單的詳細資料,還是要透過 GetOrder 取得,建議在資料下鑽到訂單詳細資料的時候,呼叫 GetOrder 取得單筆訂單的全部詳情。

GetOrders

API 參考文件: https://open.taobao.tw/doc/api.htm#/api?cid=9&path=/orders/get
訂單初始化時,可以一次回傳所有主訂單資料。以下為範例。
傳入參數:

參數名稱 範例傳入參數值
Order_Status all
Page_Size 2
Page 1

傳出參數:

{
  "result": {
    "model_list": [
      {
        "creation_time": 1592988843859,
        "trade_order_id": "558757367941",
        "buyer_id": "2000007867941",
        "seller_full_name": "淘寶台灣測試店鋪",
        "seller_id": "2000005665181",
        "actual_fee": "62",
        "buyer_full_name": "abbyh ",
        "shipping_fee_currency_code": "TWD",
        "shipping_fee": "52",
        "actual_shipping_fee": "52",
        "payment_channel": "CAINIAO_HILIFE_COD",
        "actual_shipping_fee_currency_code": "TWD",
        "delivery_info": {
          "area": "松山區",
          "country_code": "CN",
          "city": "台北市",
          "detail_address": "台北市松山區南京東路5段250巷3-1號  萊爾富北市松清店",
          "receiver_name": "黃**雲",
          "state": "台灣",
          "receiver_phone": "09******62"
        },
        "modification_time": 1592990587586,
        "actual_fee_currency_code": "TWD",
        "trade_order_line_id_list": [
          "\"558757467941\""
        ],
        "status": "ready_to_ship"
      },
      {
        "creation_time": 1592640805902,
        "trade_order_id": "546108399700",
        "buyer_id": "2000004999700",
        "seller_full_name": "淘寶台灣測試店鋪",
        "seller_id": "2000005665181",
        "actual_fee": "121",
        "buyer_full_name": "MiaYu ",
        "shipping_fee_currency_code": "TWD",
        "shipping_fee": "60",
        "actual_shipping_fee": "60",
        "payment_channel": "CAINIAO_SEVENELEVN_COD",
        "actual_shipping_fee_currency_code": "TWD",
        "delivery_info": {
          "area": "大安區",
          "country_code": "CN",
          "city": "台北市",
          "detail_address": "台北市大安區基隆路二段142之1號及142之2號 7-ELEVEN欣隆昌",
          "receiver_name": "余**萱",
          "state": "台灣",
          "receiver_phone": "09******08"
        },
        "modification_time": 1592641475712,
        "actual_fee_currency_code": "TWD",
        "trade_order_line_id_list": [
          "\"546108499700\""
        ],
        "status": "ready_to_ship"
      }
    ],
    "success": true,
    "total_count": 12,
    "page_no": 1,
    "page_size": 2
  },
  "code": "0",
  "request_id": "0b1196a615934150810894026"
}

GetOrderItems

API 參考文件: https://open.taobao.tw/doc/api.htm#/api?cid=9&path=/order/items/get
訂單初始化時,可以一次回傳主訂單內歸屬子訂單的基礎資料。
傳入參數:

參數名稱 範例傳入參數值
trade_order_line_id_list 558757467941
Page_Size 50
Page 1

傳出參數:

{
  "result": {
    "model_list": [
      {
        "creation_time": 1592988843859,
        "product_main_image": "https://img-ovs.alicdn.com/other/gsp/e4b96b68d61f18a93aaab544d278b8ef.jpeg",
        "product_detail_url": "https://item.taobao.tw/products/i242178746-s3065252106.html?urlFlag=true&mp=1",
        "trade_order_id": "558757367941",
        "trade_order_line_id": "558757467941",
        "package_id": "FO054911000916205",
        "product_id": "242178746",
        "unit_fee": "10",
        "unit_fee_currency_code": "TWD",
        "shipment_list": [
          {
            "order_no": 1
          },
          {
            "order_no": 2,
            "tracking_number": "20KXH23050207",
            "logistics_id": "LP00184048254522"
          }
        ],
        "quantity": 1,
        "actual_fee": "62",
        "sku_info": "[{\"valueId\":-1,\"valueText\":\"黑色\",\"propertyName\":\"色系\",\"propertyId\":226649326},{\"valueId\":-1,\"valueText\":\"50\",\"propertyName\":\"產品尺寸\",\"propertyId\":19447}]",
        "sku_id": "3065252106",
        "buyer_full_name": "abbyh ",
        "product_title": "親膚棉白T",
        "shipping_fee_currency_code": "TWD",
        "shipping_fee": "52",
        "actual_shipping_fee": "52",
        "actual_shipping_fee_currency_code": "TWD",
        "modification_time": 1592990587586,
        "actual_fee_currency_code": "TWD",
        "status": "ready_to_ship"
      }
    ],
    "success": true,
    "total_count": 1,
    "page_no": 1,
    "page_size": 50
  },
  "code": "0",
  "request_id": "0b1196a615934158080334966"
}

GetOrder

API 參考文件: https://open.taobao.tw/doc/api.htm#/api?cid=9&path=/order/get
訂單最完整的資料,在查看單張訂單詳情的時候請調用這支API
傳入參數:

參數名稱 範例傳入參數值
trade_order_id 558757367941

傳出參數:

{
  "result": {
    "success": true,
    "module": {
      "creation_time": 1592988843859,
      "trade_order_id": "558757367941",
      "buyer_id": "2000007867941",
      "seller_full_name": "台灣淘寶測試店鋪",
      "seller_id": "2000005665181",
      "actual_fee": "62",
      "buyer_full_name": "abbyh ",
      "shipping_fee_currency_code": "TWD",
      "shipping_fee": "52",
      "actual_shipping_fee": "52",
      "payment_channel": "CAINIAO_HILIFE_COD",
      "actual_shipping_fee_currency_code": "TWD",
      "delivery_info": {
        "area": "松山區",
        "country_code": "CN",
        "city": "台北市",
        "detail_address": "台北市松山區南京東路5段250巷3-1號  萊爾富北市松清店",
        "receiver_name": "黃**雲",
        "state": "台灣",
        "receiver_phone": "09******62"
      },
      "trade_order_line_list": [
        {
          "product_main_image": "https://img-ovs.alicdn.com/other/gsp/e4b96b68d61f18a93aaab544d278b8ef.jpeg",
          "creation_time": 1592988843859,
          "product_detail_url": "https://item.taobao.tw/products/i242178746-s3065252106.html?urlFlag=true&mp=1",
          "trade_order_id": "558757367941",
          "trade_order_line_id": "558757467941",
          "package_id": "FO054911000916205",
          "product_id": "242178746",
          "unit_fee": "10",
          "unit_fee_currency_code": "TWD",
          "shipment_list": [
            {
              "order_no": 1
            },
            {
              "order_no": 2,
              "tracking_number": "20KXH23050207",
              "logistics_id": "LP00184048254522"
            }
          ],
          "quantity": 1,
          "sku_info": "[{\"valueId\":-1,\"valueText\":\"黑色\",\"propertyName\":\"色系\",\"propertyId\":226649326},{\"valueId\":-1,\"valueText\":\"50\",\"propertyName\":\"產品尺寸\",\"propertyId\":19447}]",
          "actual_fee": "62",
          "sku_id": "3065252106",
          "product_title": "親膚棉白T",
          "buyer_full_name": "abbyh ",
          "shipping_fee_currency_code": "TWD",
          "shipping_fee": "52",
          "actual_shipping_fee": "52",
          "actual_shipping_fee_currency_code": "TWD",
          "modification_time": 1592990587586,
          "actual_fee_currency_code": "TWD",
          "status": "ready_to_ship"
        }
      ],
      "actual_fee_currency_code": "TWD",
      "modification_time": 1592990587586,
      "status": "ready_to_ship"
    }
  },
  "code": "0",
  "request_id": "0b8f2d6615934162722035063"
}

新增訂單與舊訂單狀態同步

訂單初始化以後,您會需要取得新進的訂單,以及對還未處裡的訂單進行狀態同步(訂單取消、物流狀態變更)
此時可以調用 GetOrders,只要調整傳入參數就可以取得最新的訂單狀態。
當您需要在一天結束時自動同步當日有更新的訂單,可使用 modification_time_start 與 modification_time_end 來取得在這段時間內有新增或更新的訂單。

GetOrders

API 參考文件: https://open.taobao.tw/doc/api.htm#/api?cid=9&path=/orders/get
傳入要查詢的更新時間區段,取得這段時間有新增或更新的訂單。
傳入參數:

參數名稱 範例傳入參數值
Order_Status all
Page_Size 2
Page 1
modification_time_start 1592731387000
modification_time_end 1593076987000

傳出參數:

{
  "result": {
    "model_list": [
      {
        "creation_time": 1592988843859,
        "trade_order_id": "558757367941",
        "buyer_id": "2000007867941",
        "seller_full_name": "台灣淘寶測試店鋪",
        "seller_id": "2000005665181",
        "actual_fee": "62",
        "buyer_full_name": "abbyh ",
        "shipping_fee_currency_code": "TWD",
        "shipping_fee": "52",
        "actual_shipping_fee": "52",
        "payment_channel": "CAINIAO_HILIFE_COD",
        "actual_shipping_fee_currency_code": "TWD",
        "delivery_info": {
          "area": "松山區",
          "country_code": "CN",
          "city": "台北市",
          "detail_address": "台北市松山區南京東路5段250巷3-1號  萊爾富北市松清店",
          "receiver_name": "黃**雲",
          "state": "台灣",
          "receiver_phone": "09******62"
        },
        "modification_time": 1592990587586,
        "actual_fee_currency_code": "TWD",
        "trade_order_line_id_list": [
          "\"558757467941\""
        ],
        "status": "ready_to_ship"
      }
    ],
    "success": true,
    "total_count": 1,
    "page_no": 1,
    "page_size": 2
  },
  "code": "0",
  "request_id": "0b8f2d6615934169508565874"
}

FAQ

关于此文档暂时还没有FAQ
返回
顶部