服务商模式刷脸支付 java获取调用凭证一直报错?
long now=System.currentTimeMillis()/1000;
Map map = new LinkedHashMap<>();
DeviceSubmerchants deviceSubmerchants=this.getSubmerchantsId(deviceId);
String nonceStr =this.getRandomStringByLength(32);
String aa="{\"address\":\"北京市西城区\",\"age\":\"23\",\"name\":\"JSON\"}";
map.put("appid",openId);
map.put("cmd","get_wxpayface_authinfo");
map.put("attach",aa);
map.put("device_id",deviceId);
map.put("mch_id",mchId);
map.put("nonce_str",nonceStr);
map.put("now", Long.toString(now));
map.put("rawdata",rawdata);
map.put("sign_type","MD5");
map.put("store_id",storeId);
map.put("store_name",storeName);
map.put("sub_appid",deviceSubmerchants.getSubAppid());
map.put("sub_mch_id",deviceSubmerchants.getSubMchId());
map.put("version","1");
String signStr = String.format("appid=%s&attach=%s&attach=%s&device_id=%s&mch_id=%s&nonce_str=%s&now=%s&rawdata=%s&sign_type=%s&store_id=%s&store_name=%s&sub_appid=%s&sub_mch_id=%s&version=%s&key=%s",
openId,aa,"get_wxpayface_authinfo",deviceId,mchId,nonceStr, Long.toString(now),rawdata,"MD5",storeId,storeName,deviceSubmerchants.getSubAppid(),deviceSubmerchants.getSubMchId(),"1",key);
String signMD5 = MD5Util.getMd5String(signStr);
map.put("sign", signMD5.toUpperCase());
String requestXmlStr =XmlUtil.MapToXML(map);
logger.info("统一下单参数xml:" + requestXmlStr);
// 返回xml结果
String responseXmlStr = HttpRequestUtils.post(WxAuthinfoUrl, requestXmlStr);
下面是请求的xml 搞不懂啊 一直报签名错误,只有获取凭证,下单报这个错,查询和撤销都没有问题