收藏
回答

特约商户提交申请单API提交返回提示生成签名值错误,检查签名生成没有问题啊!急急急在线等

// 拼签名串

StringBuffer sb = new StringBuffer();

sb.append("POST").append("\n");

sb.append("/v3/applyment4sub/applyment/").append("\n");

sb.append(timestamp).append("\n");

sb.append(nonce_str).append("\n");

sb.append(business).append("\n");

System.out.println(sb.toString());

//计算签名值

String sign = new String(Base64.encodeBase64(ApiclientCertUtil.signRSA(sb.toString(), ApiclientCertUtil.getRsaPrivateKey())));

// 拼装http头的Authorization内容

String authorization = "WECHATPAY2-SHA256-RSA2048 mchid=\"" + ApiclientCertUtil.getMchid() + "\",nonce_str=\"" + nonce_str

+ "\",signature=\"" + sign + "\",timestamp=\"" + timestamp + "\",serial_no=\"" + ApiclientCertUtil.getSerial_no() + "\"";

// 设置头部

post.addHeader("Content-Type", "application/json");

post.addHeader("Accept", "application/json");

post.addHeader("Wechatpay-Serial", serial_no);

post.addHeader("Authorization", authorization);

返回错误信息:

"code":"SIGN_ERROR","detail":{"detail":{"issue":"sign not match"},"field":"signature","location":"authorization"

特约商户入驻全部参数都要提交吗?有部分不是必要提交的我就没添,是不是签名拼接第5行body的请求参数json参数不全的问题吗?

回答关注问题邀请回答
收藏

2 个回答

登录 后发表内容
问题标签