使用达达即时配送方案,在预下单(https://api.weixin.qq.com/cgi-bin/express/local/business/order/pre_add?access_token=ACCESS_TOKEN)时,出现2003错误,错误返回如下:
{"resultcode":2003,"resultmsg":"签名错误","fee":0,"deliverfee":0,"tips":0,"insurancefee":0,"distance":0,"delivery_token":"","dispatch_duration":0}
请求信息如下($data):
{
"cargo": {
"goods_value": "97.80",
"goods_weight": "3",
"goods_pickup_info": "",
"goods_delivery_info": "",
"cargo_first_class": "\u65e5\u7528\u767e\u8d27",
"cargo_second_class": "\u5ba0\u7269\u7528\u54c1"
},
"delivery_sign": "a6967774e37d812ca9d887efce235ce5606540d3",
"delivery_id": "DADA",
"openid": "o7OLI5V-JEIH-5qwuonh-ThNCinA",
"order_info": {
"order_type": "0"
},
"receiver": {
"name": "\u5f20\u4e09",
"city": "\u5357\u4eac",
"address": "\u5e7f\u5dde\u5e02\u6d77\u73e0\u533a\u65b0\u6e2f\u4e2d\u8def397\u53f7",
"address_detail": "\u5e7f\u5dde\u5e02\u6d77\u73e0\u533a\u65b0\u6e2f\u4e2d\u8def397\u53f7",
"phone": "020-81167888",
"lng": "113.3237686157",
"lat": "23.0964202881"
},
"shop_id": "dadae5e77242bf27905",
"shop_order_id": "110",
"shop_no": "39160-433264",
"shop": {
"wxa_path": "\/historyOrderDetail\/historyOrderDetail?order_id=110",
"img_url": "https:\/\/cyanlake.cn\/crd\/shopImg\/1\/coverImg.jpg",
"goods_name": "\u9752\u6e56\u6d4b\u8bd5\u5e97",
"goods_count": "10"
}
}
达达提供的appkey:$dada_shop_id="dadae5e77242bf27905";$dada_app_secret="如需要可提供";
加密算法:$delivery_sign=sha1($dada_shop_id.$shop_order_id.$dada_app_secret);
-------------------------------------------------
请求发送:
$data = array(//主参数构建
"cargo"=>$cargo,
"delivery_sign"=>$delivery_sign,
"delivery_id"=>$delivery_id,
"openid"=>$user_openid,
"order_info"=>$order_info,
"receiver"=>$receiver,
"shop_id" =>$dada_shop_id,
"shop_order_id"=>$shop_order_id,
"shop_no"=>$dadaID,
"shop"=>$shop
);
$url="https://api.weixin.qq.com/cgi-bin/express/local/business/order/pre_add?access_token=".$accessToken;
$data=json_encode($data,JSON_UNESCAPED_UNICODE);
$options = array(
'http' => array(
'method' => 'POST',
'header'=>"Content-type: application/x-www-form-urlencoded;charset=gb2312\r\n".
"Content-length:".strlen($data)."\r\n",
'content' => $data,
)
);
$context = stream_context_create($options);
$codeinfo = file_get_contents($url,false,$context);
服务器使用php7.3
$dada_shopid = "dadae074b66c46154cd" ;
$shop_order_id = "shop_order001" ;
$dada_appsecret = "131fdbfb7b2b6893c35da280c19d26aa" ;
$delivery_sign = sha1($dada_shopid.$shop_order_id.$dada_appsecret);
报错 2003 签名错误,能帮忙看看吗?达达的 immediateDelivery.addOrder
你好解决了么 我也是这个问题 不知道到底哪里出问题了
1 达达那里应该注册两个号,一个是商户号,一个是开发者账号,然后登入商户号,并绑定开发者账号,此时关联成功之后,然后在微信小程序后台新增绑定那里,添加上面的商户号,此时商户号和开发者账号都关联上了小程序,此时才能app_key和app_secret才是对应的
文档算法
delivery_sign=SHA1(shopid + shop_order_id + AppSecret)
我的算法
$delivery_sign=sha1($dada_shop_id.$shop_order_id.$dada_app_secret);
其中$dada_shop_id=达达APP_Key=dadae5e77242bf27905
$dada_app_secret=达达APP_Secret
以上两个值,从达达开放平台-我是商户入口进入并获得,且和immediateDelivery.getBindAccount接口查询结果一致
$shop_order_id=自定义订单编号
且我算出来的$delivery_sign和网上工具算出来的sha1结果相等
所以。。。想请教一下这个$delivery_sign是不是还有什么我没考虑到的坑?
签名错误指delivery_sign设置不对,请参考
https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/immediate-delivery/read_first.html
delivery_sign=SHA1(shopid + shop_order_id + AppSecret)
我的算法
$delivery_sign=sha1($dada_shop_id.$shop_order_id.$dada_app_secret);
其中$dada_shop_id=达达APP_Key=dadae5e77242bf27905
$dada_app_secret=达达APP_Secret
以上两个值,从达达开放平台-我是商户入口进入并获得,且和immediateDelivery.getBindAccount接口查询结果一致
$shop_order_id=自定义订单编号
且我算出来的$delivery_sign和网上工具算出来的sha1结果相等
所以。。。想请教一下这个$delivery_sign是不是还有什么我没考虑到的坑?