服务端生成的 {"prepay_id":"wx18120927662278be133d62971e64070001“}
params.put("appId", ""); // 应用 ID
params.put("mchid", ""); // 商户号
params.put("prepay_id", "wx18120927662278be133d62971e64070001"); // 服务器返回的 prepay_id
params.put("nonce_str", nonceStr); // 随机字符串
params.put("timeStamp", String.valueOf(timestamp)); // 随机字符串
String apiKey = ""; // 商户 API 密钥
// 生成客户端签名
String signature = generateClientSignature(params, apiKey);
PayReq req = new PayReq();
req.appId = "";
req.partnerId = "";
req.prepayId = prepayId; // 从回调中获取 prepay_id
req.nonceStr = nonceStr; // 填入随机字符串
req.timeStamp = String.valueOf(timestamp);
req.packageValue = "Sign=WXPay";
req.signType="HmacSHA256";
req.sign = signature;
api.sendReq(req); // 发起支付请求
app调起微信 显示支付签名失败!!!
值应该为HMAC-SHA256
注意:签名方式一定要与统一下单接口使用的一致
另注意字段大小写可参考: https://wechatpay.im/guide/digital-signature#symmetric.frontend.cashpay