登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.online.order.create/
调用示例(JAVA)
复制全部代码
OrderCreateRequest request = new OrderCreateRequest(); GiftCardList giftCardList = new GiftCardList(); giftCardList.setGiftCardType("01"); giftCardList.setGiftCardAmount("10.00"); giftCardList.setGiftCardCode("1232332342"); FullReductionInfo fullReductionInfo = new FullReductionInfo(); fullReductionInfo.setActivityId("1233434"); fullReductionInfo.setBonusId("2079097"); fullReductionInfo.setFullReductionAmount("2.00"); fullReductionInfo.setFullReductionType("1"); fullReductionInfo.setProvider("01"); CouponInfo couponInfo = new CouponInfo(); couponInfo.setCouponAmount("1.00"); couponInfo.setCouponCode("21212"); couponInfo.setCouponType("01"); PlatFormOrder platFormOrder = new PlatFormOrder(); platFormOrder.setBusinessSign("0"); List
couponInfoList = new ArrayList
(); couponInfoList.add(couponInfo); platFormOrder.setCouponInfo(couponInfoList); List
fullReductionInfoList = new ArrayList
(); fullReductionInfoList.add(fullReductionInfo); platFormOrder.setFullReductionInfo(fullReductionInfoList); platFormOrder.setOrderItemId("22222222222222"); platFormOrder.setOrderItemStatus("01"); platFormOrder.setOrderPayment("10.00"); platFormOrder.setOuterSkuId("123456789"); platFormOrder.setPointAmount("1.00"); platFormOrder.setPostage("5.00"); platFormOrder.setPrice("100.00"); platFormOrder.setPromotionNum("201419801004**"); platFormOrder.setSaleNum("3"); platFormOrder.setSelectedArrivalTime("2018-08-01-2"); platFormOrder.setSelectedInstallDate("111"); platFormOrder.setSkuId("1234"); platFormOrder.setTotalFee("12.00"); List
giftCardListList = new ArrayList
(); giftCardListList.add(giftCardList); platFormOrder.setGiftCardList(giftCardListList); PlatFormTrade platFormTrade = new PlatFormTrade(); platFormTrade.setAccntBank("南京银行"); platFormTrade.setBankAccntNum("6YUIOP3456789009876"); platFormTrade.setBespoke("Y"); platFormTrade.setCartTwoNo("DLJA2018114812000000"); platFormTrade.setChanId("01"); platFormTrade.setInvoiceContent("餐饮"); platFormTrade.setInvoiceTitle("个人消费"); platFormTrade.setInvoiceTitleType("01"); platFormTrade.setInvoiceType("01"); platFormTrade.setIsSupportPromotion("0"); platFormTrade.setMemberNo("23456543"); platFormTrade.setOrderId("123342312"); platFormTrade.setOrderStatus("01"); platFormTrade.setOrderType("A001"); platFormTrade.setPayment("100.00"); List
platFormOrderList = new ArrayList
(); platFormOrderList.add(platFormOrder); platFormTrade.setPlatFormOrder(platFormOrderList); platFormTrade.setReceiverAddress("修文路9号"); platFormTrade.setReceiverCity("南京市"); platFormTrade.setReceiverCounty("江宁区"); platFormTrade.setReceiverMobile("12345678900"); platFormTrade.setReceiverName("张三"); platFormTrade.setReceiverNationality("中国"); platFormTrade.setReceiverPhone("025-22222222"); platFormTrade.setReceiverProvince("江苏省"); platFormTrade.setReceiverStreet("淳化街道"); platFormTrade.setReceiverZip("210000"); platFormTrade.setRegAddr("举例:南京市白下区淮海路68号苏18F"); platFormTrade.setRegPhone("02584418888"); platFormTrade.setTaxMobilePhone("02584418888"); platFormTrade.setTaxPayerAddr("南京市白下区淮宁电器大厦18F"); platFormTrade.setTaxPayerName("张三"); platFormTrade.setTaxPayerNo("21111"); platFormTrade.setTaxPayerPhone("02584418888"); platFormTrade.setTotalNo("2"); 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 { OrderCreateResponse response = client.excute(request); System.out.println("返回json/xml格式数据 :" + response.getBody()); } catch (SuningApiException e) { e.printStackTrace(); }
调用示例(PHP)
复制全部代码
$req = new OrderCreateRequest(); $giftCardList = new GiftCardList(); $giftCardList->setGiftCardType("01"); $giftCardList->setGiftCardAmount("10.00"); $giftCardList->setGiftCardCode("1232332342"); $fullReductionInfo = new FullReductionInfo(); $fullReductionInfo->setActivityId("1233434"); $fullReductionInfo->setBonusId("2079097"); $fullReductionInfo->setFullReductionAmount("2.00"); $fullReductionInfo->setFullReductionType("1"); $fullReductionInfo->setProvider("01"); $couponInfo = new CouponInfo(); $couponInfo->setCouponAmount("1.00"); $couponInfo->setCouponCode("21212"); $couponInfo->setCouponType("01"); $platFormOrder = new PlatFormOrder(); $platFormOrder->setBusinessSign("0"); $platFormOrder->setCouponInfo(array($couponInfo)); $platFormOrder->setFullReductionInfo(array($fullReductionInfo)); $platFormOrder->setOrderItemId("22222222222222"); $platFormOrder->setOrderItemStatus("01"); $platFormOrder->setOrderPayment("10.00"); $platFormOrder->setOuterSkuId("123456789"); $platFormOrder->setPointAmount("1.00"); $platFormOrder->setPostage("5.00"); $platFormOrder->setPrice("100.00"); $platFormOrder->setPromotionNum("201419801004**"); $platFormOrder->setSaleNum("3"); $platFormOrder->setSelectedArrivalTime("2018-08-01-2"); $platFormOrder->setSelectedInstallDate("111"); $platFormOrder->setSkuId("1234"); $platFormOrder->setTotalFee("12.00"); $platFormOrder->setGiftCardList(array($giftCardList)); $platFormTrade = new PlatFormTrade(); $platFormTrade->setAccntBank("南京银行"); $platFormTrade->setBankAccntNum("6YUIOP3456789009876"); $platFormTrade->setBespoke("Y"); $platFormTrade->setCartTwoNo("DLJA2018114812000000"); $platFormTrade->setChanId("01"); $platFormTrade->setInvoiceContent("餐饮"); $platFormTrade->setInvoiceTitle("个人消费"); $platFormTrade->setInvoiceTitleType("01"); $platFormTrade->setInvoiceType("01"); $platFormTrade->setIsSupportPromotion("0"); $platFormTrade->setMemberNo("23456543"); $platFormTrade->setOrderId("123342312"); $platFormTrade->setOrderStatus("01"); $platFormTrade->setOrderType("A001"); $platFormTrade->setPayment("100.00"); $platFormTrade->setPlatFormOrder(array($platFormOrder)); $platFormTrade->setReceiverAddress("修文路9号"); $platFormTrade->setReceiverCity("南京市"); $platFormTrade->setReceiverCounty("江宁区"); $platFormTrade->setReceiverMobile("12345678900"); $platFormTrade->setReceiverName("张三"); $platFormTrade->setReceiverNationality("中国"); $platFormTrade->setReceiverPhone("025-22222222"); $platFormTrade->setReceiverProvince("江苏省"); $platFormTrade->setReceiverStreet("淳化街道"); $platFormTrade->setReceiverZip("210000"); $platFormTrade->setRegAddr("举例:南京市白下区淮海路68号苏18F"); $platFormTrade->setRegPhone("02584418888"); $platFormTrade->setTaxMobilePhone("02584418888"); $platFormTrade->setTaxPayerAddr("南京市白下区淮宁电器大厦18F"); $platFormTrade->setTaxPayerName("张三"); $platFormTrade->setTaxPayerNo("21111"); $platFormTrade->setTaxPayerPhone("02584418888"); $platFormTrade->setTotalNo("2"); $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)
复制全部代码
OrderCreateRequest request = new OrderCreateRequest(); OrderCreateGiftCardListReq giftCardList = new OrderCreateGiftCardListReq(); giftCardList.giftCardType = "01"; giftCardList.giftCardAmount = "10.00"; giftCardList.giftCardCode = "1232332342"; OrderCreateFullReductionInfoReq fullReductionInfo = new OrderCreateFullReductionInfoReq(); fullReductionInfo.activityId = "1233434"; fullReductionInfo.bonusId = "2079097"; fullReductionInfo.fullReductionAmount = "2.00"; fullReductionInfo.fullReductionType = "1"; fullReductionInfo.provider = "01"; OrderCreateCouponInfoReq couponInfo = new OrderCreateCouponInfoReq(); couponInfo.couponAmount = "1.00"; couponInfo.couponCode = "21212"; couponInfo.couponType = "01"; OrderCreatePlatFormOrderReq platFormOrder = new OrderCreatePlatFormOrderReq(); platFormOrder.businessSign = "0"; List
couponInfoList = new List
(); couponInfoList.Add(couponInfo); platFormOrder.couponInfo = couponInfoList; List
fullReductionInfoList = new List
(); fullReductionInfoList.Add(fullReductionInfo); platFormOrder.fullReductionInfo = fullReductionInfoList; platFormOrder.orderItemId = "22222222222222"; platFormOrder.orderItemStatus = "01"; platFormOrder.orderPayment = "10.00"; platFormOrder.outerSkuId = "123456789"; platFormOrder.pointAmount = "1.00"; platFormOrder.postage = "5.00"; platFormOrder.price = "100.00"; platFormOrder.promotionNum = "201419801004**"; platFormOrder.saleNum = "3"; platFormOrder.selectedArrivalTime = "2018-08-01-2"; platFormOrder.selectedInstallDate = "111"; platFormOrder.skuId = "1234"; platFormOrder.totalFee = "12.00"; List
giftCardListList = new List
(); giftCardListList.Add(giftCardList); platFormOrder.giftCardList = giftCardListList; OrderCreatePlatFormTradeReq platFormTrade = new OrderCreatePlatFormTradeReq(); platFormTrade.accntBank = "南京银行"; platFormTrade.bankAccntNum = "6YUIOP3456789009876"; platFormTrade.bespoke = "Y"; platFormTrade.cartTwoNo = "DLJA2018114812000000"; platFormTrade.chanId = "01"; platFormTrade.invoiceContent = "餐饮"; platFormTrade.invoiceTitle = "个人消费"; platFormTrade.invoiceTitleType = "01"; platFormTrade.invoiceType = "01"; platFormTrade.isSupportPromotion = "0"; platFormTrade.memberNo = "23456543"; platFormTrade.orderId = "123342312"; platFormTrade.orderStatus = "01"; platFormTrade.orderType = "A001"; platFormTrade.payment = "100.00"; List
platFormOrderList = new List
(); platFormOrderList.Add(platFormOrder); platFormTrade.platFormOrder = platFormOrderList; platFormTrade.receiverAddress = "修文路9号"; platFormTrade.receiverCity = "南京市"; platFormTrade.receiverCounty = "江宁区"; platFormTrade.receiverMobile = "12345678900"; platFormTrade.receiverName = "张三"; platFormTrade.receiverNationality = "中国"; platFormTrade.receiverPhone = "025-22222222"; platFormTrade.receiverProvince = "江苏省"; platFormTrade.receiverStreet = "淳化街道"; platFormTrade.receiverZip = "210000"; platFormTrade.regAddr = "举例:南京市白下区淮海路68号苏18F"; platFormTrade.regPhone = "02584418888"; platFormTrade.taxMobilePhone = "02584418888"; platFormTrade.taxPayerAddr = "南京市白下区淮宁电器大厦18F"; platFormTrade.taxPayerName = "张三"; platFormTrade.taxPayerNo = "21111"; platFormTrade.taxPayerPhone = "02584418888"; platFormTrade.totalNo = "2"; 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); OrderCreateResponse response = client.Execute(request);
调用示例(PYTHON)
复制全部代码
# -*- coding: utf-8 -*- import suning.api request = suning.api.OrderCreateRequest() request.platFormTrade={"taxPayerAddr":"南京市白下区淮宁电器大厦18F","invoiceTitleType":"01","bankAccntNum":"6YUIOP3456789009876","chanId":"01","cartTwoNo":"DLJA2018114812000000","taxPayerNo":"21111","receiverStreet":"淳化街道","receiverAddress":"修文路9号","invoiceTitle":"个人消费","totalNo":"2","receiverName":"张三","taxPayerName":"张三","orderId":"123342312","memberNo":"23456543","bespoke":"Y","receiverPhone":"025-22222222","platFormOrder":[{"orderItemId":"22222222222222","fullReductionInfo":[{"fullReductionAmount":"2.00","activityId":"1233434","fullReductionType":"1","bonusId":"2079097","provider":"01"}],"businessSign":"0","selectedInstallDate":"111","saleNum":"3","postage":"5.00","orderPayment":"10.00","totalFee":"12.00","price":"100.00","pointAmount":"1.00","giftCardList":[{"giftCardAmount":"10.00","giftCardCode":"1232332342","giftCardType":"01"}],"orderItemStatus":"01","outerSkuId":"123456789","skuId":"1234","promotionNum":"201419801004**","selectedArrivalTime":"2018-08-01-2","couponInfo":[{"couponAmount":"1.00","couponType":"01","couponCode":"21212"}]}],"payment":"100.00","orderType":"A001","regPhone":"02584418888","isSupportPromotion":"0","receiverCounty":"江宁区","invoiceType":"01","receiverMobile":"12345678900","accntBank":"南京银行","receiverProvince":"江苏省","regAddr":"举例:南京市白下区淮海路68号苏18F","receiverNationality":"中国","orderStatus":"01","taxMobilePhone":"02584418888","receiverCity":"南京市","taxPayerPhone":"02584418888","receiverZip":"210000","invoiceContent":"餐饮"} 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)