SDK使用方法
注意:只针对JAVA语言,版本为jdk1.6及以上
//设置appkey和密钥(seckey) ApiExecutor apiExecutor = new ApiExecutor("appKey","secKey"); //构造API入参和出参 //API出入参类命名规则:API名称每个单词首字母大写,并去掉分隔符(“.”),末尾加上Param(或Result),其中Param为入参、Result为出参 //以创建订单API为例,API名称:alibaba.trade.fastCreateOrder AlibabatradefastCreateOrderParam param = new AlibabatradefastCreateOrderParam(); param.setFlow("general");//大市场普通订单:general param.setMessage("这里是买家留言"); Alibabatradefastaddress address = new Alibabatradefastaddress(); address.setProvinceText("浙江省"); address.setCityText("杭州市"); address.setAreaText("滨江区"); address.setAddress("网商路699号"); address.setFullName("张三"); address.setMobile("13988888888"); address.setPostCode("888888"); param.setAddressParam(address); List cargoList = new ArrayList(); Alibabatradefastcargo cargo = new Alibabatradefastcargo(); cargo.setOfferId(557856910956L); cargo.setSpecId("a63c985e3358d02b842322fc287be521"); cargo.setQuantity(5D); cargoList.add(cargo); param.setCargoParamList(cargoList.toArray(new Alibabatradefastcargo[]{})); //调用API并获取返回结果 AlibabatradefastCreateOrderResult result = apiExecutor.execute(param,"accessToken"); //对返回结果进行操作 if (result.getSuccess()) { String orderId = result.getResult().getOrderId(); System.out.println(orderId); }