gateway:"https://openapi.alipaydev.com/gateway.do"appId: "这是收款方的appid,采纳沙箱环境的话就是那个appid"privateKey: "利用私钥"format: "json"charset: "UTF-8"publicKey: "支付宝公钥"signType: "RSA2"return_url:"示意解决了业务当前胜利跳转的地址"notify_url:"响应的url,回调的controller,必须公网能拜访"
##### 支付宝二维码领取(可参考官网文档,曾经十分具体)
//支付宝退款接口,
public static String RefundOrder(TradeRefundVo tradeRefund) throws BizException {//TradeRefundVo 本人定义的实体类,可依据官网文档的api进行封装 AlipayConfig alipay = AlipayConfig.getInstance(); //实例化客户端 AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGateway(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType()); AlipayTradeRefundRequest alipayTradeRefundRequest = new AlipayTradeRefundRequest(); AlipayTradeRefundModel alipayTradeRefundModel = new AlipayTradeRefundModel(); alipayTradeRefundModel.setOutTradeNo(tradeRefund.getOut_trade_no()); alipayTradeRefundModel.setRefundAmount(tradeRefund.getRefund_amount()); alipayTradeRefundModel.setRefundReason(tradeRefund.getTrade_reason()); alipayTradeRefundRequest.setBizModel(alipayTradeRefundModel); try { AlipayTradeRefundResponse response = alipayClient.execute(alipayTradeRefundRequest); logger.info("response申请体的参数为{}" + response.getBody()); if (response.isSuccess()) { System.out.println("退款接口调用胜利"); } else { System.out.println("退款接口调用失败"); } return response.getBody(); } catch (AlipayApiException e) { e.printStackTrace(); logger.info("退款出现异常"); logger.error(e.getMessage(), e.fillInStackTrace()); throw new BizException(AlipayException); }}