登录
退出
首页
开放版图
苏宁有货
商家后台
文档中心
文档中心
API文档
消息中心
平台公告
工单
我的工单
提交工单
控制台
SDK调用示例
suning.pptv.pushorder.add/
调用示例(JAVA)
复制全部代码
import com.suning.api.entity.pptv.PushOrderAddRequest; import com.suning.api.entity.pptv.PushOrderAddResponse; PushOrderAddRequest request = new PushOrderAddRequest(); request.setBuyerNick("_82203a3f81a78d1292ef@alipay"); request.setDeliveryArea("0270702"); request.setHopeArrivalTime("2016-01-01 01:01:01"); request.setInvoiceFlag("0"); request.setInvoiceName("苏宁易购"); request.setInvoiceType("01"); Order order= new Order(); order.setCreated("2017-02-19 12:07:16"); order.setDiscountFee("0"); order.setNum("2"); order.setNumIId("173681370"); order.setOrderitemId("2153"); order.setPayment("520"); order.setPayTime("2017-02-19 12:07:56"); order.setPayTypeAmount("520"); order.setPayTypeCode("4235"); order.setPayTypeDesc("支付宝"); order.setPrice("520"); order.setStoreCode("DZ30"); order.setTotalFee("520"); List
orderList =new ArrayList
(); orderList.add(order); request.setOrder(orderList); request.setOrderId("2017021912071637922761"); request.setPostFee("0.00"); request.setReceiverAddress("关山大道1号光谷软件园光谷展示中心C座5层"); request.setReceiverCity("武汉市"); request.setReceiverDistrict("洪山区"); request.setReceiverMobile("13995596082"); request.setReceiverName("姜先生"); request.setReceiverPhone("13995596082"); request.setReceiverState("湖北省"); request.setReceiverTown("关山街道"); request.setReceiverZip("223700"); request.setSellerNick("pptv聚力官方商城"); //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 { PushOrderAddResponse response = client.excute(request); System.out.println("返回json/xml格式数据 :" + response.getBody()); } catch (SuningApiException e) { e.printStackTrace(); }
调用示例(PHP)
复制全部代码
$req = new PushOrderAddRequest(); $req -> setBuyerNick("_82203a3f81a78d1292ef@alipay"); $req -> setDeliveryArea("0270702"); $req -> setHopeArrivalTime("2016-01-01 01:01:01"); $req -> setInvoiceFlag("0"); $req -> setInvoiceName("苏宁易购"); $req -> setInvoiceType("01"); $order= new Order(); $order-> setCreated("2017-02-19 12:07:16"); $order-> setDiscountFee("0"); $order-> setNum("2"); $order-> setNumIId("173681370"); $order-> setOrderitemId("2153"); $order-> setPayment("520"); $order-> setPayTime("2017-02-19 12:07:56"); $order-> setPayTypeAmount("520"); $order-> setPayTypeCode("4235"); $order-> setPayTypeDesc("支付宝"); $order-> setPrice("520"); $order-> setStoreCode("DZ30"); $order-> setTotalFee("520"); $req -> setOrder(array($order)); $req -> setOrderId("2017021912071637922761"); $req -> setPostFee("0.00"); $req -> setReceiverAddress("关山大道1号光谷软件园光谷展示中心C座5层"); $req -> setReceiverCity("武汉市"); $req -> setReceiverDistrict("洪山区"); $req -> setReceiverMobile("13995596082"); $req -> setReceiverName("姜先生"); $req -> setReceiverPhone("13995596082"); $req -> setReceiverState("湖北省"); $req -> setReceiverTown("关山街道"); $req -> setReceiverZip("223700"); $req -> setSellerNick("pptv聚力官方商城"); //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.CustomPptvRequest; using suning_api_sdk.BizResponse.CustomPptvResponse; using suning_api_sdk.Models.CustomPptvModel; PushOrderAddRequest request = new PushOrderAddRequest(); request.buyerNick="_82203a3f81a78d1292ef@alipay"; request.deliveryArea="0270702"; request.hopeArrivalTime="2016-01-01 01:01:01"; request.invoiceFlag="0"; request.invoiceName="苏宁易购"; request.invoiceType="01"; PushOrderAddOrderReq order= new PushOrderAddOrderReq(); order.created="2017-02-19 12:07:16"; order.discountFee="0"; order.num="2"; order.numIId="173681370"; order.orderitemId="2153"; order.payment="520"; order.payTime="2017-02-19 12:07:56"; order.payTypeAmount="520"; order.payTypeCode="4235"; order.payTypeDesc="支付宝"; order.price="520"; order.storeCode="DZ30"; order.totalFee="520"; List
orderList =new ArrayList
(); orderList.add(order); request.order=orderList; request.orderId="2017021912071637922761"; request.postFee="0.00"; request.receiverAddress="关山大道1号光谷软件园光谷展示中心C座5层"; request.receiverCity="武汉市"; request.receiverDistrict="洪山区"; request.receiverMobile="13995596082"; request.receiverName="姜先生"; request.receiverPhone="13995596082"; request.receiverState="湖北省"; request.receiverTown="关山街道"; request.receiverZip="223700"; request.sellerNick="pptv聚力官方商城"; //开启日志调试,当测试稳定之后建议设置为 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); PushOrderAddResponse response = client.Execute(request);
调用示例(PYTHON)
复制全部代码
# -*- coding: utf-8 -*- import suning.api request = suning.api.pptv.PushOrderAddRequest() request.buyerNick="_82203a3f81a78d1292ef@alipay"; request.deliveryArea="0270702"; request.hopeArrivalTime="2016-01-01 01:01:01"; request.invoiceFlag="0"; request.invoiceName="苏宁易购"; request.invoiceType="01"; request. order= [{ created:"2017-02-19 12:07:16", discountFee:"0", num:"2", numIId:"173681370", orderitemId:"2153", payment:"520", payTime:"2017-02-19 12:07:56", payTypeAmount:"520", payTypeCode:"4235", payTypeDesc:"支付宝", price:"520", storeCode:"DZ30", totalFee:"520", }]; request.orderId="2017021912071637922761"; request.postFee="0.00"; request.receiverAddress="关山大道1号光谷软件园光谷展示中心C座5层"; request.receiverCity="武汉市"; request.receiverDistrict="洪山区"; request.receiverMobile="13995596082"; request.receiverName="姜先生"; request.receiverPhone="13995596082"; request.receiverState="湖北省"; request.receiverTown="关山街道"; request.receiverZip="223700"; request.sellerNick="pptv聚力官方商城"; 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)