Java Code Examples for com.alipay.api.AlipayClient#execute()
The following examples show how to use
com.alipay.api.AlipayClient#execute() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AliPayUtils.java From pay with Apache License 2.0 | 6 votes |
/** * 关闭订单 * @param payConfig 支付配置 * @param orderNo 订单号 * @return 订单信息 */ public static String closeOrder(AliPayConfig payConfig, String orderNo) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayTradeCloseRequest request = new AlipayTradeCloseRequest(); request.setBizContent("{" + "\"out_trade_no\":\""+orderNo+"\"" + " }"); AlipayTradeCloseResponse response = null; try { response = alipayClient.execute(request); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 2
Source File: AliPayUtils.java From pay with Apache License 2.0 | 6 votes |
/** * 订单查询接口 * @param payConfig 支付参数 * @param orderNo 订单号 * @return 订单详细 */ public static String queryOrder(AliPayConfig payConfig, String orderNo,String authToken) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); request.setBizContent("{" + "\"out_trade_no\":\""+orderNo+"\""+ " }"); AlipayTradeQueryResponse response = null; try { response = alipayClient.execute(request,null,authToken); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 3
Source File: AliPayUtils.java From pay with Apache License 2.0 | 6 votes |
/** * 刷新token * @param payConfig 支付配置 * @param token token * @return 订单信息 */ public static String refreshAccessToken(AliPayConfig payConfig, String token) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayOpenAuthTokenAppRequest request = new AlipayOpenAuthTokenAppRequest(); request.setBizContent("{" + " \"grant_type\":\"refresh_token\"," + " \"refresh_token\":\""+token+"\"" + " }"); AlipayOpenAuthTokenAppResponse response = null; try { response = alipayClient.execute(request); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 4
Source File: AliPayUtils.java From pay with Apache License 2.0 | 6 votes |
/** * 通过code获取token * @param payConfig 支付配置 * @param code code * @return 订单信息 */ public static String getAccessToken(AliPayConfig payConfig, String code) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayOpenAuthTokenAppRequest request = new AlipayOpenAuthTokenAppRequest(); request.setBizContent("{" + " \"grant_type\":\"authorization_code\"," + " \"code\":\""+code+"\"" + " }"); AlipayOpenAuthTokenAppResponse response = null; try { response = alipayClient.execute(request); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 5
Source File: AliPayUtil.java From roncoo-pay with Apache License 2.0 | 6 votes |
/** * 订单查询 * * @return */ public static Map<String, Object> tradeQuery(String outTradeNo) { logger.info("======>支付宝交易查询"); String charset = "UTF-8"; String format = "json"; String signType = "RSA2"; AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfigUtil.trade_query_url, AlipayConfigUtil.app_id, AlipayConfigUtil.mch_private_key, format, charset, AlipayConfigUtil.ali_public_key, signType); SortedMap<String, Object> bizContentMap = new TreeMap<>(); bizContentMap.put("out_trade_no", outTradeNo); AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); request.setBizContent(JSONObject.toJSONString(bizContentMap)); try { AlipayTradeQueryResponse response = alipayClient.execute(request); JSONObject responseJSON = JSONObject.parseObject(JSONObject.toJSONString(response)); logger.info("支付宝订单查询返回结果:{}", responseJSON); return responseJSON; } catch (AlipayApiException e) { logger.error("支付宝交易查询异常:{}", e); return null; } }
Example 6
Source File: AliPayUtils.java From pay with Apache License 2.0 | 6 votes |
/** * 退款接口 * @param payConfig 支付参数 * @param orderNo 订单号 * @param refundAmount 退款金额 * @return */ public static String refundOrder(AliPayConfig payConfig, String orderNo, String out_request_no, String authToken,String refundAmount) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); request.setBizContent("{" + "\"out_trade_no\":\""+orderNo+"\"," + "\"out_request_no\":\""+out_request_no+"\"," + "\"refund_amount\":"+refundAmount+"" + " }"); AlipayTradeRefundResponse response = null; try { response = alipayClient.execute(request,null,authToken); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 7
Source File: AliPayUtils.java From pay with Apache License 2.0 | 6 votes |
/** * 查询订单状态 * @param payConfig 支付信息 * @param token token * @return */ public static String queryAccessToken(AliPayConfig payConfig, String token) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayOpenAuthTokenAppQueryRequest request = new AlipayOpenAuthTokenAppQueryRequest(); request.setBizContent("{" + " \"app_auth_token\":\""+token+"\"" + " }"); AlipayOpenAuthTokenAppQueryResponse response = null; try { response = alipayClient.execute(request); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 8
Source File: AliPayUtils.java From pay with Apache License 2.0 | 6 votes |
/** * 查询订单状态 * @param payConfig 支付信息 * @param token token * @return */ public static String queryAccessToken(AliPayConfig payConfig, String token) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayOpenAuthTokenAppQueryRequest request = new AlipayOpenAuthTokenAppQueryRequest(); request.setBizContent("{" + " \"app_auth_token\":\""+token+"\"" + " }"); AlipayOpenAuthTokenAppQueryResponse response = null; try { response = alipayClient.execute(request); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 9
Source File: PayController.java From sdb-mall with Apache License 2.0 | 6 votes |
@RequestMapping("/refund/{no}") public void testTradeRefund(@PathVariable String no) throws Exception { AlipayClient client = new DefaultAlipayClient(AlipayConfig.URL, AlipayConfig.APPID, AlipayConfig.RSA_PRIVATE_KEY, AlipayConfig.FORMAT, AlipayConfig.CHARSET, AlipayConfig.ALIPAY_PUBLIC_KEY,AlipayConfig.SIGNTYPE); AlipayTradeRefundModel model = new AlipayTradeRefundModel(); model.setOutTradeNo(no); //与预授权转支付商户订单号相同,代表对该笔交易退款 model.setRefundAmount("0.01"); model.setRefundReason("预授权退款测试"); model.setOutRequestNo("refund0000001");//标识一次退款请求,同一笔交易多次退款需要保证唯一,如部分退款则此参数必传。 AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); request.setBizModel(model); AlipayTradeRefundResponse response = client.execute(request); log.info("response: {}"+response.getBody()); //退款失败的"fund_change":"N" // {"alipay_trade_refund_response":{"code":"10000","msg":"Success","buyer_logon_id":"mqv***@sandbox.com","buyer_user_id":"2088102171383132","fund_change":"N","gmt_refund_pay":"2018-08-30 15:39:03","out_trade_no":"13c7b574-5f54-42da-8165-e9fc0602f74e","refund_fee":"0.01","send_back_fee":"0.00","trade_no":"2018083021001004130500297310"},"sign":"LgzBU1K7056OLY0AAvFAZBVcZuXXt7PTbZDms5nB5qieslSKiKbYc22Jw4As/GdCJJuH7NVEtBABRM9UBXtTJBCGGn7By/H+vZfkulv43E4ASHvLC8OjXiPrypUO4SDleBTB4WW5h3Vnwk8q/SJ+UXv0lb5xrib84Zspsbz//3rrhzqGJ2sr/40YZIoIuevq/OAmLAkbNuAyIiC4ZxkJijF+mD3PbITTdYs/5e4cVEwriZcdLWnptblucSUtjKwEZvwaAuXuB+CEbqaMEBnpPgye0yqvY9tNb6PmVxHX7sc8sL9rfgDjK09xIXMhU9tgh0R/cgPZsRXvSs/HjHiqlA=="} //退款成功的"fund_change":"Y" // {"alipay_trade_refund_response":{"code":"10000","msg":"Success","buyer_logon_id":"mqv***@sandbox.com","buyer_user_id":"2088102171383132","fund_change":"Y","gmt_refund_pay":"2018-08-30 15:42:15","out_trade_no":"2936025a-73eb-4273-8b1c-dfa8d637ff70","refund_fee":"0.01","send_back_fee":"0.00","trade_no":"2018083021001004130500297311"},"sign":"Nr6WroDGtVfWVCvqSSY7Z2SPtV68UbN9eII9GSMIZ3D4xlMRd+NoEUPl8EB9h3z2T8rR7fUrjAAjfIfC5qamaW6LW9tGXI4d8GprgU0YGx+53ZqyXJIaz3LeSJ6+U7NsC3h62/jOmgow6qAqca/XHkjHXmDTeERC+D6nqJLY28E5EKbVZK2IvupCo4sJLih8nI6BS0H5IjVIsRztAjgosrqCHic32JUel4/uyouBfRGPp5pp+3fzbxdJ1yMbUeKjuipNFS9Bhdvdt3ngTJoOAF+o7vQn7DIsJZQn5zNNP3BCEeXZIiXEfF/yha2HBlAM/ush5yZBpjMhDLXYRGuJUQ=="} }
Example 10
Source File: AliPayUtils.java From pay with Apache License 2.0 | 6 votes |
/** * 撤销订单 * @param payConfig 支付配置 * @param orderNo 订单号 * @return 订单信息 */ public static String cancelOrder(AliPayConfig payConfig, String orderNo,String authToken) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayTradeCancelRequest request = new AlipayTradeCancelRequest(); request.setBizContent("{" + "\"out_trade_no\":\""+orderNo+"\"" + " }"); AlipayTradeCancelResponse response = null; try { response = alipayClient.execute(request,null,authToken); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 11
Source File: AlipayOAuth2Template.java From cola with MIT License | 6 votes |
@Override protected AccessGrant postForAccessGrant(String accessTokenUrl, MultiValueMap<String, String> parameters) { AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", properties.getAppId(), properties.getPrivateKey(), properties.getPrivateKey(), properties.getCharset(), properties.getPublicKey(), properties.getSignType()); AlipaySystemOauthTokenRequest request = new AlipaySystemOauthTokenRequest(); request.setCode(parameters.getFirst("credential")); request.setGrantType("authorization_code"); try { AlipaySystemOauthTokenResponse oauthTokenResponse = alipayClient.execute(request); if (oauthTokenResponse.isSuccess()) { return new AccessGrant(oauthTokenResponse.getAccessToken(), null, oauthTokenResponse.getRefreshToken(), Long.valueOf(oauthTokenResponse.getExpiresIn())); }else{ throw new IllegalArgumentException(oauthTokenResponse.getCode() + ":" + oauthTokenResponse.getMsg()); } } catch (AlipayApiException e) { //处理异常 throw new IllegalArgumentException(e.getMessage()); } }
Example 12
Source File: AliPayUtils.java From pay with Apache License 2.0 | 6 votes |
/** * 通过code获取token * @param payConfig 支付配置 * @param code code * @return 订单信息 */ public static String getAccessToken(AliPayConfig payConfig, String code) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayOpenAuthTokenAppRequest request = new AlipayOpenAuthTokenAppRequest(); request.setBizContent("{" + " \"grant_type\":\"authorization_code\"," + " \"code\":\""+code+"\"" + " }"); AlipayOpenAuthTokenAppResponse response = null; try { response = alipayClient.execute(request); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 13
Source File: AliPayServiceImpl.java From common-project with Apache License 2.0 | 5 votes |
@Override public OrderQueryResponse orderQuery(String orderNum) throws AlipayApiException { //TODO 根据实际业务参数填写 Integer orderFrom=0; AliPayConfig aliPayConfig= (AliPayConfig) getPayConfig(orderFrom); AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",aliPayConfig.getAppId(),aliPayConfig.getAppPrivateKey(),"json",aliPayConfig.getCharset(),aliPayConfig.getAliPayPublicKey(),"RSA2"); AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); request.setBizContent("{\"out_trade_no\":\""+orderNum+"\"}"); AlipayTradeQueryResponse response = alipayClient.execute(request); if(!response.isSuccess()){ return null; } return null; }
Example 14
Source File: AliPayUtils.java From pay with Apache License 2.0 | 5 votes |
/** * 当面付 : 条码支付 * @param orderNo 商户订单id * @param payCode 用户支付码 * @param title 订单标题 * @param storeId 商户id * @param totalAmount 总金额 * @return 支付结果 */ public static String barcodePay(AliPayConfig payConfig, String orderNo , String payCode , String title , String storeId , String totalAmount , String timeoutExpress) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayTradePayRequest request = new AlipayTradePayRequest(); //创建API对应的request类 request.setBizContent("{" + " \"out_trade_no\":\""+orderNo+"\"," + " \"scene\":\"bar_code\"," + " \"auth_code\":\""+payCode+"\"," + " \"subject\":\""+title+"\"," + " \"store_id\":\""+storeId+"\"," + " \"timeout_express\":\""+timeoutExpress+"\"," + " \"total_amount\":\""+totalAmount+"\"" + " }"); //设置业务参数 System.out.println(request.getBizContent()); AlipayTradePayResponse response = null; //通过alipayClient调用API,获得对应的response类 try { response = alipayClient.execute(request); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 15
Source File: AliPayUtil.java From wish-pay with Apache License 2.0 | 5 votes |
@SuppressWarnings({"rawtypes", "unchecked"}) protected static AlipayResponse getResponse(AlipayClient client, AlipayRequest request) { try { AlipayResponse response = client.execute(request); if (response != null) { log.info(response.getBody()); } return response; } catch (AlipayApiException e) { e.printStackTrace(); return null; } }
Example 16
Source File: AliPayUtils.java From pay with Apache License 2.0 | 5 votes |
/** * 当面付 : 条码支付 * @param orderNo 商户订单id * @param payCode 用户支付码 * @param title 订单标题 * @param storeId 商户id * @param totalAmount 总金额 * @return 支付结果 */ public static String barcodePay(AliPayConfig payConfig, String orderNo ,String authToken, String payCode , String title , String storeId , String totalAmount) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayTradePayRequest request = new AlipayTradePayRequest(); //创建API对应的request类 request.setBizContent("{" + " \"out_trade_no\":\""+orderNo+"\"," + " \"scene\":\"bar_code\"," + " \"auth_code\":\""+payCode+"\"," + " \"subject\":\""+title+"\"," + " \"store_id\":\""+storeId+"\"," + " \"timeout_express\":\"2m\"," + " \"total_amount\":\""+totalAmount+"\"" + " }"); //设置业务参数 AlipayTradePayResponse response = null; //通过alipayClient调用API,获得对应的response类 try { response = alipayClient.execute(request,null,authToken); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 17
Source File: AliPayUtils.java From pay with Apache License 2.0 | 5 votes |
/** * 当面付 : 条码支付 * @param orderNo 商户订单id * @param payCode 用户支付码 * @param title 订单标题 * @param storeId 商户id * @param totalAmount 总金额 * @return 支付结果 */ public static String barcodePay(AliPayConfig payConfig, String orderNo ,String authToken, String payCode , String title , String storeId , String totalAmount,String sys_service_provider_id , String timeoutExpress) { AlipayClient alipayClient = new DefaultAlipayClient( AliPayConfig.URL, payConfig.getAppId(), payConfig.getAppPrivateKey(), AliPayConfig.FORMAT, AliPayConfig.CHARSET, payConfig.getAlipayPublicKey(), payConfig.getSignType()); AlipayTradePayRequest request = new AlipayTradePayRequest(); //创建API对应的request类 request.setBizContent("{" + " \"out_trade_no\":\""+orderNo+"\"," + " \"scene\":\"bar_code\"," + " \"auth_code\":\""+payCode+"\"," + " \"subject\":\""+title+"\"," + " \"store_id\":\""+storeId+"\"," + " \"timeout_express\":\""+timeoutExpress+"\"," + " \"extend_params\":{" + " \"sys_service_provider_id\":\""+sys_service_provider_id+"\"" + " }," + " \"total_amount\":\""+totalAmount+"\"" + " }"); //设置业务参数 AlipayTradePayResponse response = null; //通过alipayClient调用API,获得对应的response类 try { response = alipayClient.execute(request,null,authToken); } catch (AlipayApiException e) { logger.error(e.getMessage()); return null; } return response.getBody(); }
Example 18
Source File: AbsAlipayService.java From MeetingFilm with Apache License 2.0 | 5 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) protected AlipayResponse getResponse(AlipayClient client, AlipayRequest request) { try { AlipayResponse response = client.execute(request); if (response != null) { log.info(response.getBody()); } return response; } catch (AlipayApiException e) { e.printStackTrace(); return null; } }
Example 19
Source File: AlipayTradeWithHBServiceImpl.java From MeetingFilm with Apache License 2.0 | 4 votes |
private AlipayTradePayResponse getResponse(AlipayClient client, AlipayTradePayRequest request, final String outTradeNo, final long beforeCall) { try { AlipayTradePayResponse response = client.execute(request); if (response != null) { log.info(response.getBody()); } return response; } catch (AlipayApiException e) { // 获取异常真实原因 Throwable cause = e.getCause(); if (cause instanceof ConnectException || cause instanceof NoRouteToHostException) { // 建立连接异常 executorService.submit(new Runnable() { @Override public void run() { listener.onConnectException(outTradeNo, beforeCall); } }); } else if (cause instanceof SocketException) { // 报文上送异常 executorService.submit(new Runnable() { @Override public void run() { listener.onSendException(outTradeNo, beforeCall); } }); } else if (cause instanceof SocketTimeoutException) { // 报文接收异常 executorService.submit(new Runnable() { @Override public void run() { listener.onReceiveException(outTradeNo, beforeCall); } }); } e.printStackTrace(); return null; } }
Example 20
Source File: AliPayUtil.java From roncoo-pay with Apache License 2.0 | 4 votes |
/** * 支付宝被扫(扫码设备) * * @param outTradeNo * @param authCode * @param subject * @param amount * @param body * @param roncooPayGoodsDetailses * @return */ public static Map<String, Object> tradePay(String outTradeNo, String authCode, String subject, BigDecimal amount, String body, List<RoncooPayGoodsDetails> roncooPayGoodsDetailses) { logger.info("======>支付宝被扫"); String charset = "UTF-8"; String format = "json"; String signType = "RSA2"; String scene = "bar_code";//支付场景--条码支付 String totalAmount = amount.toString();//订单金额 String discountableAmount = "0.0";//默认折扣金额为0,建议由业务系统记录折扣金额,值传递给支付宝实际支付金额 String storeId = "ykt_pay_store_id"; // (必填) 商户门店编号,通过门店号和商家后台可以配置精准到门店的折扣信息,详询支付宝技术支持 String timeExpress = "5m";// 支付超时,线下扫码交易定义为5分钟 AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfigUtil.trade_pay_url, AlipayConfigUtil.app_id, AlipayConfigUtil.mch_private_key, format, charset, AlipayConfigUtil.ali_public_key, signType); SortedMap<String, Object> paramMap = new TreeMap<>(); paramMap.put("out_trade_no", outTradeNo); paramMap.put("scene", scene); paramMap.put("auth_code", authCode); paramMap.put("subject", subject); paramMap.put("total_amount", totalAmount); paramMap.put("discountable_amount", discountableAmount); paramMap.put("body", body); paramMap.put("store_id", storeId); paramMap.put("timeout_express", timeExpress); // 商品明细列表,需填写购买商品详细信息, if (roncooPayGoodsDetailses != null && roncooPayGoodsDetailses.size() > 0) { List<SortedMap<String, Object>> goodsList = new ArrayList<>(); for (RoncooPayGoodsDetails roncooPayGoodsDetails : roncooPayGoodsDetailses) { SortedMap<String, Object> goodsMap = new TreeMap<>(); goodsMap.put("goods_id", roncooPayGoodsDetails.getGoodsId()); goodsMap.put("goods_name", roncooPayGoodsDetails.getGoodsName()); goodsMap.put("quantity", roncooPayGoodsDetails.getNums()); goodsMap.put("price", roncooPayGoodsDetails.getSinglePrice()); goodsList.add(goodsMap); } paramMap.put("goods_detail", goodsList); } SortedMap<String, Object> extendParamsMap = new TreeMap<>(); extendParamsMap.put("sys_service_provider_id", AlipayConfigUtil.partner); paramMap.put("extend_params", extendParamsMap); AlipayTradePayRequest request = new AlipayTradePayRequest(); System.out.println(JSONObject.toJSONString(paramMap)); request.setBizContent(JSONObject.toJSONString(paramMap)); try { AlipayTradePayResponse response = alipayClient.execute(request); JSONObject responseJSON = JSONObject.parseObject(JSONObject.toJSONString(response)); logger.info("支付宝返回结果:{}", responseJSON); return responseJSON; } catch (AlipayApiException e) { logger.error("支付宝扫码,支付异常:{}", e); JSONObject resultJSON = new JSONObject(); resultJSON.put("outTradeNo", outTradeNo); resultJSON.put("totalAmount", amount); resultJSON.put("errorCode", "9999"); return resultJSON; } }