1.將公鑰驗證升級爲證書驗證,會得到如下三個證書
2.配置文件相關
#支付寶支付相關配置
alipayconfig:
appid:
pid:
app-private-key:
charset: utf-8
alipay-public-key:
call-back-url: http://xxx.cn/alipay/callBack
appCode:
pubPath:D:\workspace\\src\main\resources\appCertPublicKey_2019103168821258.crt
rootPath: D:\workspace\\src\main\resources\alipayRootCert.crt
pubJobPath: D:\workspace\\src\main\resources\alipayCertPublicKey_RSA2.crt
3.工具類相關
/**
* 公鑰證書方式
*
* @return
* @throws AlipayApiException
*/
public static AlipayClient getAliPalyClientByCert() throws AlipayApiException {
CertAlipayRequest certAlipayRequest = new CertAlipayRequest();
certAlipayRequest.setServerUrl("https://openapi.alipay.com/gateway.do");
certAlipayRequest.setAppId(APP_ID());
certAlipayRequest.setPrivateKey(APP_PRIVATE_KEY());
certAlipayRequest.setForma