web端网站接入支付宝支付过程( 二 )

nn","orderNo": "20200217155823617499935" }}7、回调方法相关代码/*** 支付宝支付通知* @param request* @param response* @return* @throws IOException*/ @RequestMapping(value=https://www.isolves.com/it/cxkf/bk/2020-03-16/"/alipayNotice.do",method = RequestMethod.POST) @ResponseBody @NoneAuth @SysLog(actionName = "支付宝支付通知") public String alipayNotice(HttpServletRequest request, HttpServletResponse response) throws IOException {Map params = new HashMap();Map requestParams = request.getParameterMap();for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {String name = (String) iter.next();String[] values = (String[]) requestParams.get(name);String valueStr = "";for (int i = 0; i < values.length; i++) {valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ",";}params.put(name, valueStr);}// 切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看 。try {boolean flag = AlipaySignature.rsaCheckV1(params, AlipayConfig.ALIPAY_PUBLIC_KEY, AlipayConfig.CHARSET,AlipayConfig.SIGN_TYPE);if (flag) {String tradeStatus = params.get("trade_status");String outTradeNo = params.get("out_trade_no");String tradeNo = params.get("trade_no");//购买者用户IDString openId = params.get("buyer_logon_id");this.orderService.alipayNotice(tradeStatus,outTradeNo,tradeNo,openId);if ("TRADE_SUCCESS".equals(tradeStatus)){return "success";}}} catch (Exception e) {e.printStackTrace();}return "fail"; }大致如上,欢迎大家批评指正

【web端网站接入支付宝支付过程】


推荐阅读