如题:在NativePayService中封装的预下单,url是固定的,通过配置hostName也仅可以更改成hk的域名,那怎么开启沙箱环境呢?
在postman中直接请求https://api.mch.weixin.qq.com/xdc/apiv2sandbox/v3/pay/transactions/native,提示商户号非法,我是否可以认为沙箱中可以测试这个v3接口呢?
puPrepayResponse prepay(PrepayRequest request) {
String requestPath = "https://api.mch.weixin.qq.com/v3/pay/transactions/native";
PrepayRequest realRequest = request;
if (this.hostName != null) {
requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue());
}
HttpHeaders headers = new HttpHeaders();
headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
HttpRequest httpRequest =
new HttpRequest.Builder()
.httpMethod(HttpMethod.POST)
.url(requestPath)
.headers(headers)
.body(createRequestBody(realRequest))
.build();
HttpResponse httpResponse =
httpClient.execute(httpRequest, PrepayResponse.class);
return httpResponse.getServiceResponse();
}
不支持