登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.online.boorder.create/
调用示例(JAVA)
复制全部代码
import com.suning.api.entity.online.BoorderCreateRequest; import com.suning.api.entity.online.BoorderCreateResponse; BoorderCreateRequest request = new BoorderCreateRequest(); PlatFormTrade platFormTrade= new PlatFormTrade(); platFormTrade.setMemberNo("13888888888"); platFormTrade.setOrderId("4567890"); platFormTrade.setOrderType("A001"); platFormTrade.setPayment("100"); PlatFormOrder platFormOrder= new PlatFormOrder(); platFormOrder.setBusinessSign("0"); platFormOrder.setOrderItemId("56789001"); platFormOrder.setOrderPayment("123"); platFormOrder.setPostage("34"); platFormOrder.setPrice("12"); platFormOrder.setSaleNum("3"); platFormOrder.setSkuId("3456789876"); platFormOrder.setSnSkuId("4567899876"); platFormOrder.setTotalFee("523"); platFormOrder.setSerialNumber("0023564565123"); platFormOrder.setPreplantCode("D024"); List
platFormOrderList =new ArrayList
(); platFormOrderList.add(platFormOrder); platFormTrade.setPlatFormOrder(platFormOrderList); platFormTrade.setReceiverAddress("门牌号93号"); platFormTrade.setReceiverCity("025"); platFormTrade.setReceiverCounty("02510"); platFormTrade.setReceiverMobile("13888888888"); platFormTrade.setReceiverName("苏宁"); platFormTrade.setReceiverNationality("中国"); platFormTrade.setReceiverPhone("1531-8295345"); platFormTrade.setReceiverProvince("100"); platFormTrade.setReceiverStreet("0251001"); platFormTrade.setReceiverZip("8876868"); platFormTrade.setTotalNo("2"); platFormTrade.setBusinessType("01"); request.setPlatFormTrade(platFormTrade); //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 { BoorderCreateResponse response = client.excute(request); System.out.println("返回json/xml格式数据 :" + response.getBody()); } catch (SuningApiException e) { e.printStackTrace(); }
调用示例(PHP)
复制全部代码
$req = new BoorderCreateRequest(); $platFormTrade= new PlatFormTrade(); $platFormTrade-> setMemberNo("13888888888"); $platFormTrade-> setOrderId("4567890"); $platFormTrade-> setOrderType("A001"); $platFormTrade-> setPayment("100"); $platFormOrder= new PlatFormOrder(); $platFormOrder-> setBusinessSign("0"); $platFormOrder-> setOrderItemId("56789001"); $platFormOrder-> setOrderPayment("123"); $platFormOrder-> setPostage("34"); $platFormOrder-> setPrice("12"); $platFormOrder-> setSaleNum("3"); $platFormOrder-> setSkuId("3456789876"); $platFormOrder-> setSnSkuId("4567899876"); $platFormOrder-> setTotalFee("523"); $platFormOrder-> setSerialNumber("0023564565123"); $platFormOrder-> setPreplantCode("D024"); $platFormTrade-> setPlatFormOrder(array($platFormOrder)); $platFormTrade-> setReceiverAddress("门牌号93号"); $platFormTrade-> setReceiverCity("025"); $platFormTrade-> setReceiverCounty("02510"); $platFormTrade-> setReceiverMobile("13888888888"); $platFormTrade-> setReceiverName("苏宁"); $platFormTrade-> setReceiverNationality("中国"); $platFormTrade-> setReceiverPhone("1531-8295345"); $platFormTrade-> setReceiverProvince("100"); $platFormTrade-> setReceiverStreet("0251001"); $platFormTrade-> setReceiverZip("8876868"); $platFormTrade-> setTotalNo("2"); $platFormTrade-> setBusinessType("01"); $req -> setPlatFormTrade($platFormTrade); //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.CustomOnlineRequest; using suning_api_sdk.BizResponse.CustomOnlineResponse; using suning_api_sdk.Models.CustomOnlineModel; BoorderCreateRequest request = new BoorderCreateRequest(); BoorderCreatePlatFormTradeReq platFormTrade= new BoorderCreatePlatFormTradeReq(); platFormTrade.memberNo="13888888888"; platFormTrade.orderId="4567890"; platFormTrade.orderType="A001"; platFormTrade.payment="100"; BoorderCreatePlatFormOrderReq platFormOrder= new BoorderCreatePlatFormOrderReq(); platFormOrder.businessSign="0"; platFormOrder.orderItemId="56789001"; platFormOrder.orderPayment="123"; platFormOrder.postage="34"; platFormOrder.price="12"; platFormOrder.saleNum="3"; platFormOrder.skuId="3456789876"; platFormOrder.snSkuId="4567899876"; platFormOrder.totalFee="523"; platFormOrder.serialNumber="0023564565123"; platFormOrder.preplantCode="D024"; List
platFormOrderList =new ArrayList
(); platFormOrderList.add(platFormOrder); platFormTrade.platFormOrder=platFormOrderList; platFormTrade.receiverAddress="门牌号93号"; platFormTrade.receiverCity="025"; platFormTrade.receiverCounty="02510"; platFormTrade.receiverMobile="13888888888"; platFormTrade.receiverName="苏宁"; platFormTrade.receiverNationality="中国"; platFormTrade.receiverPhone="1531-8295345"; platFormTrade.receiverProvince="100"; platFormTrade.receiverStreet="0251001"; platFormTrade.receiverZip="8876868"; platFormTrade.totalNo="2"; platFormTrade.businessType="01"; request.platFormTrade=platFormTrade; //开启日志调试,当测试稳定之后建议设置为 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); BoorderCreateResponse response = client.Execute(request);
调用示例(PYTHON)
复制全部代码
# -*- coding: utf-8 -*- import suning.api request = suning.api.online.BoorderCreateRequest() request. platFormTrade= { memberNo:"13888888888", orderId:"4567890", orderType:"A001", payment:"100", platFormOrder: [{ businessSign:"0", orderItemId:"56789001", orderPayment:"123", postage:"34", price:"12", saleNum:"3", skuId:"3456789876", snSkuId:"4567899876", totalFee:"523", serialNumber:"0023564565123", preplantCode:"D024", }], receiverAddress:"门牌号93号", receiverCity:"025", receiverCounty:"02510", receiverMobile:"13888888888", receiverName:"苏宁", receiverNationality:"中国", receiverPhone:"1531-8295345", receiverProvince:"100", receiverStreet:"0251001", receiverZip:"8876868", totalNo:"2", businessType:"01", }; 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)