跳转到内容
返回官网

商家取消获取的电子面单号

商家取消获取的电子面单号

一、请求参数

POST https://kf.fw199.com/gateway/pdd/waybill/cancel

参数名类型说明示例
appidString合作伙伴AppIduwkahf@jfs92
timestampString当前时间戳
seller_nickString拼多多商家账号,非店铺名称kingdo
signString接口签名如何计算生成见示例代码
waybill_codeString非必填 电子面单号
wp_codeString非必填 快递公司code

二、请求示例代码

Java

@Test
public void PddWayBillCancel() throws Exception {
String result ="";
String seller_nick = Config.PddSellerNick ; // 拼多多卖家账号
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost( Config.PddWayBillCancelUrl );
//业务参数
Map<String, String> data = new HashMap<String, String>();
data.put("appid", Config.AppId);
data.put("seller_nick", seller_nick);
Long timestamp = System.currentTimeMillis() / 1000;
data.put("timestamp", timestamp.toString());
// 非必填 电子面单号
data.put("waybill_code", "SF1324807157166");
// 非必填 快递公司code
data.put("wp_code", "SF");
// 参数签名
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);
}

需要注意的是package_info中的id为包裹id ,请不要相同。

三、返回结果

限于篇幅,以下json为部分数据

{
"code": 0,
"message": "ok",
"data": {
"cancel_result": true,
"request_id": "16118058368786768"
}
}

返回字段说明

cancel_result : 调用取消是否成功

说明: code为0表示成功,非0为失败,message会包含失败原因。失败时一定要注意,可能商户授权过期,或是参数有误。