| | |
| | | |
| | | private String alipay_root_cert_path = "C:/cert/alipay/user/alipay_root_cert_path.crt";//支付宝CA根证书文件路径 |
| | | |
| | | private String certPath = "/usr/playpai/cert/weixin/apiclient_cert.p12";//微信证书 |
| | | // private String certPath = "/usr/playpai/cert/weixin/apiclient_cert.p12";//微信证书 |
| | | private String certPath = "D:/apiclient_cert.p12";//微信证书 |
| | | |
| | | public ResultUtil confirm(String smid,String code, String outTradeNo, String amount) { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", |
| | |
| | | /** |
| | | * 支付宝支付 |
| | | */ |
| | | /** |
| | | * 支付宝支付 |
| | | */ |
| | | public ResultUtil alipay(String smid,String body, String subject, String passbackParams, String outTradeNo, String amount, String notifyUrl) { |
| | | // //构造client |
| | | // CertAlipayRequest certAlipayRequest = new CertAlipayRequest (); |
| | |
| | | // } catch (AlipayApiException e ) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | |
| | | |
| | | //实例化客户端 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | |
| | | model.setExtendParams(extendParams); |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(callbackPath + notifyUrl); |
| | | |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |