收藏
回答

统一下单接口 微信支付公钥添加Wechatpay-Serial=PublicKeyId?

/**
 * 构建httpclient(自动更新证书)
 *
 */
private HttpClient buildHttpClientAutoUpdateCertificate() {
    // 不需要传入微信支付证书了
    AutoUpdateCertificatesVerifier verifier =
       new AutoUpdateCertificatesVerifier(
          new WechatPay2Credentials(
             wxConfig.getMchId(), new PrivateKeySigner(wxConfig.getSerialNo(), getPrivateKey())),
          wxConfig.getApiV3Key().getBytes(StandardCharsets.UTF_8));
    return WechatPayHttpClientBuilder.create()
       .withMerchant(wxConfig.getMchId(), wxConfig.getSerialNo(), getPrivateKey())
       .withValidator(new WechatPay2Validator(verifier))
       .build();
}

接口返回200 但提示WechatPay2Validator     : For input string: "PUB"
回答关注问题邀请回答
收藏

1 个回答

  • Memory (私信不回复)
    Memory (私信不回复)
    04-07

    如果返回的Wechatpay-Serial为pub开头的平台公钥id,那么你就需要使用对应的平台公钥进行验证签名,报错说明你给的验证签名的平台公钥不对

    04-07
    有用
    回复 6
    查看更多(1)
登录 后发表内容