收藏
回答

使用wechatpay-apiv3接口,httpClient.execute无法识别

使用wechatpay-apiv3接口,httpClient.execute无法识别
public class HttpClient {
    //...
    String merchantId="xx";
    String merchantSerialNumber="xx";
    String merchantPrivateKey="xx";
    String wechatpayCertificates="xx";
    WechatPayHttpClientBuilder builder = WechatPayHttpClientBuilder.create()
            .withMerchant(merchantId, merchantSerialNumber, merchantPrivateKey)
            .withWechatpay(wechatpayCertificates);
// ... 接下来,你仍然可以通过builder设置各种参数,来配置你的HttpClient

    // 通过WechatPayHttpClientBuilder构造的HttpClient,会自动的处理签名和验签
    HttpClient httpClient = builder.build();
    HttpPost httpPost = new HttpPost("https://api.mch.weixin.qq.com/v3/apply4subject/applyment");

    // 后面跟使用Apache HttpClient一样
    HttpResponse response = httpClient.execute(httpPost);


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

3 个回答

登录 后发表内容
问题标签