代发-电子面单取号
获取电子面单号
代发取号
微信小店代发 - 获取电子面单号(代发取号)
一、接口名称
接口名称:微信小店代发 - 获取电子面单号(代发取号)
接口 URL:https://kf.fw199.com/gateway/wxstore/df/waybill/getcode
请求方式:POST
Content-Type:application/json
二、请求参数
| 参数名 | 类型 | 是否必需 | 说明 | 示例值 |
|---|---|---|---|---|
| **appid** | string | **是** | 开发者分配的 AppID | `Config.AppId` |
| **seller_nick** | string | **是** | 供货商 OpenID,从应用首页获取 (对应核心业务字段 ownerId) | `f524edc1-c2fa-47b0-bfea-f05bbcb14a9a` |
| **timestamp** | string | **是** | 毫秒级时间戳 | `1713824000000` |
| **sign** | string | **是** | 请求参数签名字符串 | `682bc45f6d54d28e6664aec2ace60990` |
| **delivery_id** | string | **是** | 快递公司代码,如 ZTO | `ZTO` |
| **order_type** | string | 否 | 支持的类型,枚举值默认为 1 | `1` |
| **ewaybill_order_id** | string | **是** | 自定义电子面单订单 ID,内容要求是 Uint64 | `4435896307942968320` |
| **site_code** | string | 否 | 网点编码,可从网点信息接口获取 | `200001` |
| **ewaybill_acct_id** | string | **是** | 电子面单账号 ID,从网点信息接口获取 | `acct_123` |
| **wp_type** | string | **是** | 模板类型,默认 single | `single` |
| **shop_id** | string | **是** | 网点信息接口获取的店铺 ID(注意:不是店铺 OpenID) | `shop_789` |
| **ownerId** | string | **是** | 供货商微信appid,以wx打头 | `wx3213124124` |
| **sender** | object | **是** | 寄件人信息对象,包含 name, mobile, province, city, county, address 等 | - |
| **receiver** | object | **是** | 收件人信息对象,建议传小店订单内的收件人文本信息 | - |
| **ec_order_list** | array | **是** | 订单信息列表,包含 ds_order_id, ec_order_id, goods_list 等 | - |
| **order_shop_name** | string | 否 | 代发模式必传:订单店铺名称 (与 order_shop_appid 二选一) | `我的旗舰店` |
| **ewaybill_order_appid** | string | 否 | 代发模式必传:订单店铺 AppID (与 order_shop_name 二选一) | `wx12345678` |
上面字段的详细说明参考:https://developers.weixin.qq.com/doc/store/shop/API/channels-shop-delivery/ewaybill/api_ewaybill_createorder.html
示例请求
{
"ewaybill_order_id":"4435896307942968323", "delivery_id": "SF", "site_code": "", "ewaybill_acct_id": "6643642397", "sender": { "name": "张三", "mobile": "138161271129", "province": "上海市", "city": "上海市", "county": "浦东新区", "street": "", "address": "东方路200" }, "receiver": { "name": "m**", "mobile": "138****7321", "province": "上海市", "city": "上海市", "county": "浦东新区", "street": "", "address": "****" },
"ewaybill_order_appid":"wx9acf39d4f153ceb8", "ec_order_list": [ { "ds_order_id": 4435896307942968320, "ec_order_id": 3735813677907337217, "goods_list": [ { "good_name": "夏天男士凉拖", "good_count": 1, "product_id": 10000741839533, "sku_id": 12739225212 } ] } ], "shop_id": "5009842502159", "ownerId": "wx601fb26e047505c0", "wp_type": "single"}三、请求示例代码
Java
import org.junit.Test;import java.util.HashMap;import java.util.Map;import java.util.ArrayList;import java.util.List;import com.alibaba.fastjson.JSON;
public class WxstoreDfWaybillGetCodeTest {
@Test public void waybillGetCode() throws Exception {
String apiUrl = "https://kf.fw199.com/gateway/wxstore/df/waybill/getcode"; String sellerNick = "f524edc1-c2fa-47b0-bfea-f05bbcb14a9a";
String reqData = "{\n" + "\n" + " \"ewaybill_order_id\":\"4435896307942968323\",\n" + " \"delivery_id\": \"SF\",\n" + " \"site_code\": \"\",\n" + " \"ewaybill_acct_id\": \"6643642397\",\n" + " \"sender\": {\n" + " \"name\": \"张三\",\n" + " \"mobile\": \"138161271129\",\n" + " \"province\": \"上海市\",\n" + " \"city\": \"上海市\",\n" + " \"county\": \"浦东新区\",\n" + " \"street\": \"\",\n" + " \"address\": \"东方路200\"\n" + " },\n" + " \"receiver\": {\n" + " \"name\": \"m**\",\n" + " \"mobile\": \"138****7321\",\n" + " \"province\": \"上海市\",\n" + " \"city\": \"上海市\",\n" + " \"county\": \"浦东新区\",\n" + " \"street\": \"\",\n" + " \"address\": \"****\"\n" + " },\n" + "\n" + "\t\t\"ewaybill_order_appid\":\"wx9acf39d4f153ceb8\",\n" + " \"ec_order_list\": [\n" + " {\n" + " \"ds_order_id\": 4435896307942968320,\n" + " \"ec_order_id\": 3735813677907337217,\n" + " \"goods_list\": [\n" + " {\n" + " \"good_name\": \"夏天男士凉拖\",\n" + " \"good_count\": 1,\n" + " \"product_id\": 10000741839533,\n" + " \"sku_id\": 12739225212\n" + " }\n" + " ]\n" + " }\n" + " ],\n" + " \"shop_id\": \"5009842502159\",\n" + " \"ownerId\": \"a877d3bd-cb6c-467a-becf-ea3db501c0d1\",\n" + " \"wp_type\": \"single\"\n" + "}";
data.put("request_data", reqData); // 参数签名 data.put("sign", Utils.Sign(data, Config.AppSecret));
// 调用封装好的 HTTP 请求方法 String result = doHttpRequest(apiUrl, data); System.out.println("result:" + result); }}返回结果
{ "code": 0, "message": "ok", "data": { "status": true, "waybill_id": "SF0227483653001", "ewaybill_order_id": "4435896307942968323", "print_info": "JTdCJTIycHJpbnREYXRhJTIyJTNBJTdCJTIyd2F5YmlsbElkJTIyJTNBJTIyU0YwMjI3NDgzNjUzMDAxJTIyJTJDJTIycHJpbnRUaW1lJTIyJTNBJTIyMjAyNiUyRjA0JTJGMjYlMjAxNyUzQTI0JTIyJTJDJTIyc2VydmljZXMlMjIlM0ElNUIlNUQlMkMlMjJyZWNlaXZlck5hbWUlMjIlM0ElMjJtKiolMjIlMkMlMjJyZWNlaXZlclBob25lJTIyJTNB" }, "trace_id": "48a0c463-c0fc-4872-ab4b-b906f6d534ff"}| 参数名 | 类型 | 说明 |
|---|---|---|
| ewaybill_order_id | string | 电子面单订单id |
| waybill_id | string | 快递单号 |
| print_info | string | 如果请求参数填了template_id,则返回打印报文信息,可以传给打印组件打印面单。 |