跳转到内容
返回官网

取消订单

订单确认/取消接口

客户在确定将货物交付给顺丰托运后,将面单上的一些重要信息,如快件重量通过此接口发送给顺丰 (丰桥下订单接口默认自动确认,不需客户重复确认,该操作用在其它非自动确认的场景)。客户在发货前取消订单。 注意:订单取消之后,订单号也是不能重复利用的。

一、请求参数

POST https://kf.fw199.com/gateway/sfexpress/order/update

参数名类型说明示例
appidString合作伙伴AppIduwkahf@jfs92
timestampString当前时间戳
request_dataStringjson格式的业务参数见下表1.1
client_codeString顺丰的客户编码
check_wordString顺丰的校验码
signString接口签名如何计算生成见示例代码

一(一)、参数request_data 的说明

#属性名类型(约束)必填默认值描述
1orderIdString(64)客户订单号
2dealTypeNumber(1)1客户订单操作标识:1:确认 (下订单接口默认自动确认,不需客户重复确认,该操作用在其它非自动确认的场景)2:取消
3waybillNoInfoListList顺丰运单号(如dealtype=1,必填)
4customsBatchsString(20)报关批次
5collectEmpCodeString(30)揽收员工号
6inProcessWaybillNoString(100)头程运单号
7sourceZoneCodeString(10)原寄地网点代码
8destZoneCodeString(10)目的地网点代码
9totalWeightNumber(17,5)订单货物总重量,包含子母件,单位千克,精确到小数点后3位,如果提供此值,必须>0
10totalVolumeNumber(16,5)订单货物总体积,单位立方厘米,精确到小数点后3位,会用于计抛(是否计抛具体商务沟通中双方约定)
11expressTypeIdNumber(5)快件产品类别,支持附录《快件产品类别表》的产品编码值,仅可使用与顺丰销售约定的快件产品
12extraInfoListList扩展属性
13totalLengthNumber(16, 5)客户订单货物总长,单位厘米,精确到小数点后3位,包含子母件
14totalWidthNumber(16, 5)客户订单货物总宽,单位厘米,精确到小数点后3位,包含子母件
15totalHeightNumber(16, 5)客户订单货物总高,单位厘米,精确到小数点后3位,包含子母件
16serviceListList增值服务信息

一(二)、元素 OrderUpdate/waybillNoInfoList

#属性名类型(约束)必填默认值描述
1waybillTypeNumber(1)运单号类型1:母单 2 :子单 3 : 签回单
2waybillNoString(15)运单号

一(三)、元素 OrderUpdate/waybillNoInfoList

#属性名类型(约束)必填默认值描述
1attrNameString(256)扩展字段 说明:attrName为字段定义,具体如下表,value存在attrVal
2attrValString(1024)扩展字段值

扩展字段备注

attrNameattrVal
attr001
attr002

一(四)、元素 OrderUpdate/serviceList

#属性名类型(约束)必填默认值描述
1nameString(20)增值服务名,如COD等
2valueString(30)条件增值服务扩展属性,参考增值服务传值说明
3value1String(30)条件增值服务扩展属性1
4value2String(30)条件增值服务扩展属性2
5value3String(30)条件增值服务扩展属性3
6value4String(30)条件增值服务扩展属性4

二、请求示例代码

Java

/**
* 订单确认/取消接口
* @throws Exception
*/
@Test
public void updateOrder() throws Exception {
String result ="";
// dealType:2表示取消
String jsonData = "{" +
" \"dealType\": 2," +
" \"orderId\": \"QIAO-20200618-200\"" +
"}";
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost( Config.SFExpressUpdateOrderUrl );
//业务参数
Map<String, String> data = new HashMap<String, String>();
data.put("appid", Config.AppId);
data.put("request_data", jsonData);
data.put("client_code", Config.SFClientCode);
data.put("check_word", Config.SFCheckWord);
Long timestamp = System.currentTimeMillis() / 1000;
data.put("timestamp", timestamp.toString());
// 参数签名
data.put("sign", Utils.Sign(data,Config.AppSecret));
List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
for (Map.Entry<String, String> entry : data.entrySet()) {
params.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
//发起POST请求
try {
httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
HttpResponse httpResponse = httpclient.execute(httpPost);
if (httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
result = EntityUtils.toString(httpResponse.getEntity());
} else {
result = ("doPost Error Response: " + httpResponse.getStatusLine().toString());
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(result);
}

三、返回结果

{
"code": 0,
"message": "ok",
"data": {
"apiErrorMsg": "",
"apiResponseID": "00017A89782FF53FE03591EC62C18A3F",
"apiResultCode": "A1000",
"apiResultData": "{\"success\":true,\"errorCode\":\"S0000\",\"errorMsg\":null,\"msgData\":{\"orderId\":\"QIAO-20200618-200\",\"waybillNoInfoList\":[{\"waybillType\":1,\"waybillNo\":\"SF1303262056675\"}],\"resStatus\":2,\"extraInfoList\":null,\"originCode\":null,\"destCode\":null,\"filterResult\":null,\"remark\":null,\"routeLabelInfo\":null,\"sendStartTm\":null}}"
},
"trace_id": "6WNQp8Mq9L6hGuJeQgIy"
}

说明: code为0表示成功,非0为失败,message会包含失败原因。

四、返回参数msgData说明

#属性名类型(约束)必填默认值描述
1orderIdString(64)客户订单号
2waybillNoInfoListList顺丰运单号
3resStatusNumber(1)备注1:客户订单号与顺丰运单不匹配2 :操作成功
4extraInfoListList扩展属性

四(一)、返回参数waybillNoInfoList的说明

waybillType :运单号类型 , 1:母单 2 :子单 3 : 签回单