登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.retailer.shoppingorders.create/
调用示例(JAVA)
复制全部代码
import com.suning.api.entity.retailer.ShoppingordersCreateRequest; import com.suning.api.entity.retailer.ShoppingordersCreateResponse; ShoppingordersCreateRequest request = new ShoppingordersCreateRequest(); request.setAppId("af99f27da589fbf089103f2f44c9a"); request.setBuyerName("张三"); request.setBuyerPhone("15866728686"); request.setCreateCode("1405648424"); request.setDiscountAmount("0.00"); request.setDiscountCode("6833452575344"); InstallDelivery installDelivery= new InstallDelivery(); installDelivery.setInstallBuyerAddress("XXX路31号XXX大厦A座2楼"); installDelivery.setInstallCityCode("320100"); installDelivery.setInstallCityName("南京市"); installDelivery.setInstallDistrictCode("320112"); installDelivery.setInstallDistrictName("江宁区"); installDelivery.setInstallName("张三"); installDelivery.setInstallPhone("18632678623"); installDelivery.setInstallProvinceCode("320000"); installDelivery.setInstallProvinceName("江苏省"); installDelivery.setInstallTownCode("320112"); installDelivery.setInstallTownName("江宁"); request.setInstallDelivery(installDelivery); request.setMerchantCustNo("1701014245"); request.setOrderAmount("2862.00"); OrderDelivery orderDelivery= new OrderDelivery(); orderDelivery.setBuyerAddress("XXX路31号XXX大厦A座2楼"); orderDelivery.setCityCode("320100"); orderDelivery.setCityName("南京市"); orderDelivery.setDistrictCode("320112"); orderDelivery.setDistrictName("江宁区"); orderDelivery.setProvinceCode("320000"); orderDelivery.setProvinceName("江苏省"); orderDelivery.setReceiverName("张三"); orderDelivery.setReceiverPhone("18632486868"); orderDelivery.setTownCode("320112"); orderDelivery.setTownName("江宁"); request.setOrderDelivery(orderDelivery); request.setOrderFrom("1"); OrderItem orderItem= new OrderItem(); orderItem.setBookTimeDetail("2018-07-01"); orderItem.setCmmdtyCode("E232A1000000157"); orderItem.setCmmdtyName("空调"); orderItem.setHopeArrivalTime("2018-07-01"); orderItem.setInstallFlag("0"); orderItem.setOrderType("1"); orderItem.setOuterOrderItemNo("1004654"); orderItem.setQuantity("1"); orderItem.setSellPrice("2800.00"); orderItem.setServiceCode("556421389"); orderItem.setShipMethod("1"); orderItem.setSupplierCode("SN"); orderItem.setSupplierName("苏宁"); orderItem.setTotalPayAmount("2800.00"); orderItem.setUnitPrice("27800.00"); orderItem.setDistributorCode("0000000000"); List
orderItemList =new ArrayList
(); orderItemList.add(orderItem); request.setOrderItem(orderItemList); request.setOuterOrderNo("4343424"); request.setPayAmount("2862.00"); request.setPosCode("6849451548"); request.setRemark("备注信息"); request.setSalesMode("1"); request.setStoreCode("1232130002"); request.setUserCode("00000012313"); //api入参校验逻辑开关,当测试稳定之后建议设置为 false 或者删除该行 request.setCheckParam(true); String serverUrl = "https://openpre.cnsuning.com/api/http/sopRequest"; String appKey = "你的appKey"; String appSecret = "你的appSecret"; DefaultSuningClient client = new DefaultSuningClient(serverUrl, appKey,appSecret, "json"); try { ShoppingordersCreateResponse response = client.excute(request); System.out.println("返回json/xml格式数据 :" + response.getBody()); } catch (SuningApiException e) { e.printStackTrace(); }
调用示例(PHP)
复制全部代码
$req = new ShoppingordersCreateRequest(); $req -> setAppId("af99f27da589fbf089103f2f44c9a"); $req -> setBuyerName("张三"); $req -> setBuyerPhone("15866728686"); $req -> setCreateCode("1405648424"); $req -> setDiscountAmount("0.00"); $req -> setDiscountCode("6833452575344"); $installDelivery= new InstallDelivery(); $installDelivery-> setInstallBuyerAddress("XXX路31号XXX大厦A座2楼"); $installDelivery-> setInstallCityCode("320100"); $installDelivery-> setInstallCityName("南京市"); $installDelivery-> setInstallDistrictCode("320112"); $installDelivery-> setInstallDistrictName("江宁区"); $installDelivery-> setInstallName("张三"); $installDelivery-> setInstallPhone("18632678623"); $installDelivery-> setInstallProvinceCode("320000"); $installDelivery-> setInstallProvinceName("江苏省"); $installDelivery-> setInstallTownCode("320112"); $installDelivery-> setInstallTownName("江宁"); $req -> setInstallDelivery($installDelivery); $req -> setMerchantCustNo("1701014245"); $req -> setOrderAmount("2862.00"); $orderDelivery= new OrderDelivery(); $orderDelivery-> setBuyerAddress("XXX路31号XXX大厦A座2楼"); $orderDelivery-> setCityCode("320100"); $orderDelivery-> setCityName("南京市"); $orderDelivery-> setDistrictCode("320112"); $orderDelivery-> setDistrictName("江宁区"); $orderDelivery-> setProvinceCode("320000"); $orderDelivery-> setProvinceName("江苏省"); $orderDelivery-> setReceiverName("张三"); $orderDelivery-> setReceiverPhone("18632486868"); $orderDelivery-> setTownCode("320112"); $orderDelivery-> setTownName("江宁"); $req -> setOrderDelivery($orderDelivery); $req -> setOrderFrom("1"); $orderItem= new OrderItem(); $orderItem-> setBookTimeDetail("2018-07-01"); $orderItem-> setCmmdtyCode("E232A1000000157"); $orderItem-> setCmmdtyName("空调"); $orderItem-> setHopeArrivalTime("2018-07-01"); $orderItem-> setInstallFlag("0"); $orderItem-> setOrderType("1"); $orderItem-> setOuterOrderItemNo("1004654"); $orderItem-> setQuantity("1"); $orderItem-> setSellPrice("2800.00"); $orderItem-> setServiceCode("556421389"); $orderItem-> setShipMethod("1"); $orderItem-> setSupplierCode("SN"); $orderItem-> setSupplierName("苏宁"); $orderItem-> setTotalPayAmount("2800.00"); $orderItem-> setUnitPrice("27800.00"); $orderItem-> setDistributorCode("0000000000"); $req -> setOrderItem(array($orderItem)); $req -> setOuterOrderNo("4343424"); $req -> setPayAmount("2862.00"); $req -> setPosCode("6849451548"); $req -> setRemark("备注信息"); $req -> setSalesMode("1"); $req -> setStoreCode("1232130002"); $req -> setUserCode("00000012313"); //api入参校验逻辑开关,当测试稳定之后建议设置为 false 或者删除该行 $req -> setCheckParam('true'); $serverUrl = "https://openpre.cnsuning.com/api/http/sopRequest"; $appKey = "你的appKey"; $appSecret = "你的appSecret"; $client = new DefaultSuningClient($serverUrl,$appKey,$appSecret,'json'); $resp = $client -> execute($req); print_r("返回响应报文:".$resp);
调用示例(.NET)
复制全部代码
using suning_api_sdk.BizRequest.CustomRetailerRequest; using suning_api_sdk.BizResponse.CustomRetailerResponse; using suning_api_sdk.Models.CustomRetailerModel; ShoppingordersCreateRequest request = new ShoppingordersCreateRequest(); request.appId="af99f27da589fbf089103f2f44c9a"; request.buyerName="张三"; request.buyerPhone="15866728686"; request.createCode="1405648424"; request.discountAmount="0.00"; request.discountCode="6833452575344"; ShoppingordersCreateInstallDeliveryReq installDelivery= new ShoppingordersCreateInstallDeliveryReq(); installDelivery.installBuyerAddress="XXX路31号XXX大厦A座2楼"; installDelivery.installCityCode="320100"; installDelivery.installCityName="南京市"; installDelivery.installDistrictCode="320112"; installDelivery.installDistrictName="江宁区"; installDelivery.installName="张三"; installDelivery.installPhone="18632678623"; installDelivery.installProvinceCode="320000"; installDelivery.installProvinceName="江苏省"; installDelivery.installTownCode="320112"; installDelivery.installTownName="江宁"; request.installDelivery=installDelivery; request.merchantCustNo="1701014245"; request.orderAmount="2862.00"; ShoppingordersCreateOrderDeliveryReq orderDelivery= new ShoppingordersCreateOrderDeliveryReq(); orderDelivery.buyerAddress="XXX路31号XXX大厦A座2楼"; orderDelivery.cityCode="320100"; orderDelivery.cityName="南京市"; orderDelivery.districtCode="320112"; orderDelivery.districtName="江宁区"; orderDelivery.provinceCode="320000"; orderDelivery.provinceName="江苏省"; orderDelivery.receiverName="张三"; orderDelivery.receiverPhone="18632486868"; orderDelivery.townCode="320112"; orderDelivery.townName="江宁"; request.orderDelivery=orderDelivery; request.orderFrom="1"; ShoppingordersCreateOrderItemReq orderItem= new ShoppingordersCreateOrderItemReq(); orderItem.bookTimeDetail="2018-07-01"; orderItem.cmmdtyCode="E232A1000000157"; orderItem.cmmdtyName="空调"; orderItem.hopeArrivalTime="2018-07-01"; orderItem.installFlag="0"; orderItem.orderType="1"; orderItem.outerOrderItemNo="1004654"; orderItem.quantity="1"; orderItem.sellPrice="2800.00"; orderItem.serviceCode="556421389"; orderItem.shipMethod="1"; orderItem.supplierCode="SN"; orderItem.supplierName="苏宁"; orderItem.totalPayAmount="2800.00"; orderItem.unitPrice="27800.00"; orderItem.distributorCode="0000000000"; List
orderItemList =new ArrayList
(); orderItemList.add(orderItem); request.orderItem=orderItemList; request.outerOrderNo="4343424"; request.payAmount="2862.00"; request.posCode="6849451548"; request.remark="备注信息"; request.salesMode="1"; request.storeCode="1232130002"; request.userCode="00000012313"; //开启日志调试,当测试稳定之后建议设置为 false 或者删除该行 SuningLogger.IsLogDebug = true; string serverUrl = "https://openpre.cnsuning.com/api/http/sopRequest"; string appKey = "你的appKey"; string appSecret = "你的appSecret"; ISuningClient client = new DefaultSuningClient(serverUrl, appKey,appSecret); ShoppingordersCreateResponse response = client.Execute(request);
调用示例(PYTHON)
复制全部代码
# -*- coding: utf-8 -*- import suning.api request = suning.api.retailer.ShoppingordersCreateRequest() request.appId="af99f27da589fbf089103f2f44c9a"; request.buyerName="张三"; request.buyerPhone="15866728686"; request.createCode="1405648424"; request.discountAmount="0.00"; request.discountCode="6833452575344"; request. installDelivery= { installBuyerAddress:"XXX路31号XXX大厦A座2楼", installCityCode:"320100", installCityName:"南京市", installDistrictCode:"320112", installDistrictName:"江宁区", installName:"张三", installPhone:"18632678623", installProvinceCode:"320000", installProvinceName:"江苏省", installTownCode:"320112", installTownName:"江宁", }; request.merchantCustNo="1701014245"; request.orderAmount="2862.00"; request. orderDelivery= { buyerAddress:"XXX路31号XXX大厦A座2楼", cityCode:"320100", cityName:"南京市", districtCode:"320112", districtName:"江宁区", provinceCode:"320000", provinceName:"江苏省", receiverName:"张三", receiverPhone:"18632486868", townCode:"320112", townName:"江宁", }; request.orderFrom="1"; request. orderItem= [{ bookTimeDetail:"2018-07-01", cmmdtyCode:"E232A1000000157", cmmdtyName:"空调", hopeArrivalTime:"2018-07-01", installFlag:"0", orderType:"1", outerOrderItemNo:"1004654", quantity:"1", sellPrice:"2800.00", serviceCode:"556421389", shipMethod:"1", supplierCode:"SN", supplierName:"苏宁", totalPayAmount:"2800.00", unitPrice:"27800.00", distributorCode:"0000000000", }]; request.outerOrderNo="4343424"; request.payAmount="2862.00"; request.posCode="6849451548"; request.remark="备注信息"; request.salesMode="1"; request.storeCode="1232130002"; request.userCode="00000012313"; domain = "https://openpre.cnsuning.com" appKey = "你的appKey" appSecret = "你的appSecret" request.setDomainInfo(domain,"80") request.setAppInfo(appKey,appSecret) try: result=request.getResponse() print(result) except Exception as e: print(e)