private void initWXPayService() {
File file = new File(this.getClass().getResource("/").getPath());
String path = file.getPath();
RSAConfig config = new RSAConfig.Builder()
.merchantId(Configure.getMch_id())
.merchantSerialNumber(Configure.getMerchantSerialNumber())
.privateKeyFromPath(path + "/wxpaycert/apiclient_key.pem")
.wechatPayCertificatesFromPath(
path + "/wxpaycert/apiclient_cert.pem",
path + "/wxpaycert/apiclient_platform_cert.pem")
.build();
service = new com.wechat.pay.java.service.refund.RefundService.Builder().config(config).build();
}
CreateRequest requestRefund = new CreateRequest();
AmountReq amountReq = new AmountReq();
amountReq.setTotal(totalPrice.multiply(new BigDecimal("100")).longValue());
amountReq.setRefund(refundPrice.multiply(new BigDecimal("100")).longValue());
amountReq.setCurrency("CNY");
requestRefund.setAmount(amountReq);
requestRefund.setOutTradeNo(outTradeNo);
requestRefund.setOutRefundNo(outRefundNo);
Refund refund = service.create(requestRefund);
验证签名需要用到平台证书或微信支付公钥,你给的不对