com.wechat.pay.java.core.exception.ServiceException: Wrong HttpStatusCode[403]
httpResponseBody[{"code":"NO_AUTH","message":"当前商户号接入升级版本功能,暂不支持使用升级前功能,请在产品中心-商家转账-前往功能查看接口文档"}] HttpRequest[{"http_method":"POST","url":"https://api.mch.weixin.qq.com/v3/transfer/batches","uri":"https://api.mch.weixin.qq.com/v3/transfer/batches",
由于微信支付接入比较早以前的商户号api私钥文件不见了,这次使用的是通过平台证书的方式加载privatekey,其他信息都是用的v3以及公钥,具体加载代码如下
KeyStore keyStore = KeyStore.getInstance("PKCS12");
FileInputStream fis = new FileInputStream("D:/apiclient_cert.p12");
String password = "xxx";
keyStore.load(fis, password.toCharArray());
fis.close();
// 获取别名
Enumeration<String> aliases = keyStore.aliases();
String alias = aliases.nextElement();
// 获取私钥
privateKey = (PrivateKey) keyStore.getKey(alias, password.toCharArray());
这样加载之后构造config
Config config =
new RSAPublicKeyConfig.Builder()
.merchantId("xxx")
.privateKey(privateKey)
.publicKey("xxx")
.publicKeyId("xxx")
.merchantSerialNumber("xxx")
.apiV3Key("xxx")
.build();
就是这样构建参数之后请求sdk的接口
TransferBatchService service = new TransferBatchService.
Builder().
config(getRsaPublicKeyConfig()).
build();
InitiateBatchTransferRequest request = new InitiateBatchTransferRequest();
request.setAppid("xxx");
request.setOutBatchNo("12345678");
request.setBatchName("测试转账");
request.setBatchRemark("测试转账");
request.setTotalAmount(100L);
request.setTotalNum(1);
List<TransferDetailInput> transferDetailList = new ArrayList<>();
TransferDetailInput transferDetailInput = new TransferDetailInput();
transferDetailInput.setTransferAmount(100L);
transferDetailInput.setTransferRemark("测试转账");
transferDetailInput.setOpenid("xxx");
transferDetailInput.setOutDetailNo("12345678");
transferDetailList.add(transferDetailInput);
request.setTransferDetailList(transferDetailList);
//场景可以为空
// request.setTransferSceneId();
// request.setNotifyUrl("");
InitiateBatchTransferResponse response = service.initiateBatchTransfer(request);
System.out.println(response);
请问这是什么原因

你需要调 https://pay.weixin.qq.com/doc/v3/merchant/4012716434