上图是销售订单、发货单与配送之间的关系图,销售订单可以创建多个发货单,多个发货单(不同销售订单)可以合并在一个配送订单进行发货
接口请求错误记录:
1. The api_client does not have the required permission(s).
2. Required parameter missing or invalid
注意: 开发前需要更新API访问权限
开发记录:
1. 创建发货单
//$order_id 销售订单ID$url = "/admin/api/2023-01/orders/{$order_id}/fulfillment_orders.json";$opt = [//'api_version' => '2023-01','order_id'=> $order_id,];// 返回 fulfillment_orders_id$re_s = CurlResponse($token, $shop, $url, $opt, 'GET');
2. 创建配送单
$url = "/admin/api/2023-01/fulfillments.json";$opt = ['fulfillment' => ['line_items_by_fulfillment_order' => [['fulfillment_order_id' => (int)$fulfillment_order_id, //发货单ID]],'tracking_info' => ['company' => $tracking_company, //物流公司名称 “YunExpress”"number" => $tracking_number, //物流跟踪单号"url" => $tracking_url //物流跟踪查询地址],],];$request_headers[] = "Content-Type: application/json";$re_s = CurlResponse($token, $shop, $url, $opt, 'POST',$request_headers);
配送订单 API 迁移指南: 查看
FulfillmentOrder Fulfillment