支付宝查账接口

输入订单号查账

	@RequestMapping("/tradeQuery")
	@ResponseBody
	public static String tradeQuery( String outTradeNo){
		AlipayClient alipayClient = new DefaultAlipayClient(alipay,APP_ID,APP_PRIVATE_KEY,"json","GBK",ALIPAY_PUBLIC_KEY,"RSA2");
		AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
		
		
		AlipayTradeRefundModel bizModel = new AlipayTradeRefundModel();
		bizModel.setOutTradeNo(outTradeNo);
		
		
		request.setBizModel(bizModel);
		
        String result=null;
        try {
            result = alipayClient.execute(request).getBody();
        } catch (AlipayApiException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        //输出
//        System.out.println(result);
		
        return result;
		
	}

不建议使用字符串拼接,容易造成参数错误

你可能感兴趣的:(随笔)