//沙箱版客户扫二维码支付
public String test_trade_pay(Map<String, Object> map){
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipaydev.com/gateway.do", alipay_appId, alipay_private_key , "json", charset, alipay_public_key, "RSA2");
//创建API对应的request类
AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
request.setNotifyUrl(alipay_notify_url);
request.setBizContent("{" +
" "out_trade_no":""+new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())+(int)(Math.random()*90000+10000)+""," +
" "seller_id":"2088102169838738"," +
" "total_amount":"1"," +
" "buyer_logon_id":"acmldw0191@sandbox.com"," +
" "subject":"收购阿里巴巴"," +
" "body":""+map.toString()+""," + //附加数据,传json格式会报错,json格式带有双引号""
" "timeout_express":"30m"," +
" "store_id":"NJ_001"" +
" }");
//通过alipayClient调用API,获得对应的response类
AlipayTradePrecreateResponse response;
try {
response = alipayClient.execute(request);
System.out.print(response.getBody());
return response.getBody(); //返回的参数qr_code 是支付二维码地址
} catch (AlipayApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//根据response中的结果继续业务逻辑处理
return "";
}
扫码支付文档
当面付API
当面付异步通知
入参列表