@PostMapping(value = "/callback")
public ResultVo callback(HttpServletRequest request,@RequestBody JSONObject jsonObject) throws Exception {
log.info("======进入回调callback======");
log.info("======回调接收参数======",jsonObject);
Map callBack = tPaidOrderService.wxCallBackJsapi(jsonObject);
log.info("======接收回调系统返回参数======",callBack);
return ControllerResult.success(callBack);
}
@Override
public Map wxCallBackJsapi(JSONObject jsonObject) throws Exception {
try {
String jsonString = jsonObject.toString();
JSONObject json = JSONObject.parseObject(jsonString);
String associated_data = json.getString("resource.associated_data");
String ciphertext = json.getString("resource.ciphertext");
String nonce = json.getString("resource.nonce");
String decryptData = decryptToString(associated_data.getBytes(StandardCharsets.UTF_8), nonce.getBytes(StandardCharsets.UTF_8), ciphertext);
JSONObject decryptDataObj = JSONObject.parseObject(decryptData, JSONObject.class);
log.info("{} ,parms{}, decryptDataObj:{}", decryptDataObj);
//decryptDataObj 为解码后的obj,其内容如下。之后便是验签成功后的业务处理
//{
// "sp_appid": "wx8888888888888888",
// "sp_mchid": "1230000109",
// "sub_appid": "wxd678efh567hg6999",
// "sub_mchid": "1900000109",
// "out_trade_no": "1217752501201407033233368018",
// "trade_state_desc": "支付成功",
// "trade_type": "MICROPAY",
// "attach": "自定义数据",
// "transaction_id": "1217752501201407033233368018",
// "trade_state": "SUCCESS",
// "bank_type": "CMC",
// "success_time": "2018-06-08T10:34:56+08:00",
// ...
// "payer": {
// "openid": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"
// },
// "scene_info": {
// "device_id": "013467007045764"
// }
//}
} catch (Exception e) {
log.info("{} ,parms{}, 异常:", jsonObject.toJSONString(), e);
}
Map res = new HashMap<>();
res.put("code", "SUCCESS");
res.put("message", "成功");
return res;
}
请问解决了吗?如仍未解决,可以提供下3天内的4200开头的交易订单号,协助排查
你回调路径配置了吗,是需要在微信支付那里放开一下回调路径的