基本代码参考自:https://blog.csdn.net/fengxueliuke/article/details/106585809
注意事项:
1.支付宝返回的二维码不能直接在浏览器中打开,而要用二维码转换工具来生成二维码,这里我是百度搜索草料二维码进行转义的
自己的解决方法:
在
//②进入支付页面
@RequestMapping(value = "/alipay")
public void alipay(@RequestParam("outTradeNo") String outTradeNo,
@RequestParam("subject")String subject,
@RequestParam("totalAmount")String totalAmount,
@RequestParam("body")String body,
HttpServletRequest req,
HttpServletResponse response,
Model model) throws AlipayApiException, IOException {
AlipayBean alipayBean = new AlipayBean();
alipayBean.setOut_trade_no(outTradeNo);
alipayBean.setSubject(subject);
alipayBean.setTotal_amount(totalAmount);
alipayBean.setBody(body);
//返回支付页面
response.setContentType("text/html;char