Browse all articles

连接自定义承运商 API

Last updated

ChannelDock 提供大量预构建的承运商集成,卖家和履约中心可开箱即用。但我们无法为每个承运商平台都做连接,因此开发了一套 API,让您作为承运商,可以为特定卖家或履约中心在 ChannelDock 中创建发货方式。

本指南概述完成此集成所需的步骤。
​
​步骤 1:
生成 API 凭据:

步骤 2:
下一步是在 ChannelDock 中添加您作为承运商提供的发货方式。关于端点和我们期望的 JSON 结构,详见:

步骤 3:
每当 ChannelDock 用户尝试使用您的发货方式创建面单时,我们会向您发送包含订单数据和所选发货方式详情的 JSON 对象。

{  
  "order_id": 774,  
  "seller_id": 1223,  
  "center_id": 0,  
  "api_id": 456,  
  "api_description": "Bol.com - Main shop",  
  "channel_name": "Bol.com",  
  "remote_order_id": "ORD-2025-4055",  
  "order_date": "2025-05-13 08:49:28",  
  "ship_on_date": "2025-05-14",  
  "remote_carrier_id": "postnl_standard_001",  
  "carrier_code": "given carrier_code",  
  "sender_details": {  
    "name": "John Doe",  
    "company_name": "Doe Logistics BV",  
    "street": "Keizersgracht",  
    "address_line_2": "Suite 301",  
    "country": "NL",  
    "house_number": "241",  
    "zipcode": "1016 EA",  
    "city": "Amsterdam",  
    "state_province_code": "",  
    "phone_number": "+31 20 123 4567",  
    "email": "[email protected]",  
    "signature_full_name": "John Doe",  
    "signature_initials": "JD",  
    "vat_number": "NL123456789B01",  
    "eori_number": "NL123456789000"  
  },  
  "shipping_address1": "Keizersgracht 123",  
  "shipping_address2": "2nd floor",  
  "shipping_address_supplement": "Entrance via side door",  
  "shipping_city": "Amsterdam",  
  "shipping_company": "KiteGear BV",  
  "shipping_country_code": "NL",  
  "shipping_email": "[email protected]",  
  "shipping_first_name": "Emma",  
  "shipping_house_number": "123",  
  "shipping_house_number_ext": "B",  
  "shipping_last_name": "van Dijk",  
  "shipping_middle_name": null,  
  "shipping_region": "Noord-Holland",  
  "shipping_street": "Keizersgracht",  
  "shipping_zip_code": "1015 CJ",  
  "shipping_address_accurate": 1,  
  "shipping_phone_number": "+31 6 12345678",  
  "shipping_service": "",  
  "billing_address1": "Keizersgracht 123",  
  "billing_address2": "2nd floor",  
  "billing_address_supplement": "Finance dept.",  
  "billing_city": "Amsterdam",  
  "billing_company": "KiteGear BV",  
  "billing_country_code": "NL",  
  "billing_email": "[email protected]",  
  "billing_first_name": "Emma",  
  "billing_house_number": "123",  
  "billing_house_number_ext": "B",  
  "billing_last_name": "van Dijk",  
  "billing_middle_name": null,  
  "billing_region": "Noord-Holland",  
  "billing_street": "Keizersgracht",  
  "billing_zip_code": "1015 CJ",  
  "billing_address_accurate": 1,  
  "billing_phone_number": "+31 20 1234567",  
  "total_weight": 8.0,  
  "total_length": 80,  
  "total_width": 25,  
  "total_height": 25,  
  "total_order_price": 749.95,  
  "total_order_currency": "EUR",  
  "order_products": [  
    {  
      "order_product_id": 868,  
      "order_product_price": 699.95,  
      "order_product_price_currency": "EUR",  
      "ean": "8719326583655",  
      "sku": null,  
      "quantity": 1,  
      "product_title": "North Orbit Kite 2025 - 12m",  
      "product_weight": "5.00",  
      "product_length": 80,  
      "product_width": 25,  
      "product_height": 15,  
      "product_hs_code": "95062900",  
      "remote_order_product_id": "NL-PROD-001",  
      "product_origin_country_code": "NL"  
    },  
    {  
      "order_product_id": 869,  
      "order_product_price": 50.0,  
      "order_product_price_currency": "EUR",  
      "ean": "8719326583617",  
      "sku": "TSHIRT-BLACK-M",  
      "quantity": 1,  
      "product_title": "Mystic Kite Pump Pro",  
      "product_weight": "3.00",  
      "product_length": 40,  
      "product_width": 10,  
      "product_height": 10,  
      "product_hs_code": "84142080",  
      "remote_order_product_id": "NL-PROD-002",  
      "product_origin_country_code": "DE"  
    }  
  ]  
}

收到这些数据后,您需要生成发货面单 PDF,用 Base64 编码,并返回以下响应:

{  
    "label_id": 99999, // Your internal label id  
    "carrier_code": "DHL",  
    "tracking_number": "DHL87623654234",   
    "tracking_number_url": "https://dhl.com/tracking?DHL87623654234",  
    "pdf_content_base64": "JVBERi0xLjQKJeLjzgo8PC9UeXBlL0NhdGFsb2cvUG..."  
}
属性 说明
label_id 您系统中的面单 ID。
carrier_code 创建此面单的承运商(例如:DHL、PostNL、UPS)。
tracking_number 同一承运商生成该面单对应的运单号。
tracking_number_url 用该承运商追踪此货件的链接。
pdf_content_base64 面单 PDF 文件的 Base64 文本 (A6 纸张尺寸)。

随后 ChannelDock 会打印 PDF 面单,并将运单号发送到销售渠道以处理订单。

错误响应 - http code 400 范围

{  
  "error": {  
    "message": "Human readable error explanation here"  
  }  
}

Was this helpful?

Related articles