Express bird supports EMS, SF, yzbk, yzpy, ZJS, LHT, uapex, STO, DBL, JD, xfex, hhtt, sure, kysy, PJ, CND ZTO, YD, htky, yto, ycwl, UC, ane, hoau, tlwl, dblky, aneky, jdky, LB, htkyky, ztoky, CNEX Print template setting of logistics electronic single interface such as Yunda Express (YDKY), Shunxin Jetta (SX).
Docking process
Log in the express bird website to register and obtain ID and Key—— Real name authentication - opening the required member services (electronic face list): Electronic face sheet api interface_ Application for electronic face list of express company_ Express bird electronic face sheet printing interface
As the largest third-party logistics interface service provider in China, express bird can interface with more than 40 mainstream express delivery companies at one time. When calling the interface, express bird will request the logistics company for the order number and return it in real time, which can directly print the electronic order for delivery.
Batch printing
Download the technical description document before development and docking: Electronic single interface_ Free application of electronic face list API_ Thermal electronic surface sheet printing template - Express bird For interface development, you can download the electronic face list interface DEMO (express bird "instant query DEMO" makes docking easier) for reference. The corresponding codes of express companies can be downloaded from "express company code list document", "electronic face list customer number parameter comparison table" and "express company express business type" for viewing
Using the electronic order interface also requires the electronic order number to obtain the order number. The fields of the electronic order number of each express company are different. For details, refer to the "electronic order customer number parameter comparison table". The electronic order number needs to be registered on the express bird official website. You can apply for the electronic order customer number of some express companies online, If it is not supported, you can contact the local outlet offline to apply. After the application is received, you need to contact the outlet to recharge the bill number in advance. You can get the express bill number and large amount of information by placing an order through the express bird electronic bill API
Using the electronic face list interface also requires an electronic face list account. Test environment: you must use the test account provided by the express bird, and view the corresponding account and the field name corresponding to the interface request in the "comparison table of electronic face list parameter configuration of express bird" on the official website of Express bird - help and document download;
Formal environment:
Order directly without electronic face-to-face account: SF, EMS (issued nationwide in Guangdong Province), home express, express, postal express package, China Railway Express, all-in-one Express;
Online (express bird background) application account: Yousu, Zhongtong, Yunda, Yuantong, Yuancheng express, Anneng and Baishi;
(application path: Express bird official website - Electronic face list - my express company - apply for a new express company);
For other express delivery companies, you need to apply for an account number (pre deposit number) offline with the local express delivery network before you can use it.
If you have any questions during the access process, you can add technical support to the QQ group for consultation. The specific docking documents can be downloaded from the QQ group file and tested in the test environment after the development is completed. The test environment is only provided for users to use the interface. Each express company has the same logic. One express company indicates that the interface has been adjusted. In the formal environment, Some express companies do not need an electronic face-to-face account to place orders directly. Some express companies need to apply for an account in the background of express bird. Some express companies need to apply for an account (pre deposit number) offline with local express outlets before they can be used. Electronic sheet batch printing is a downloadable electronic sheet batch printing demo: Express bird "instant query DEMO" makes docking easier For reference.
Attention should be paid during docking: (1) ensure that the e-commerce ID and key (AppKey) in the interface are completely consistent with the merchant ID and key in the user management background. (2) OrderCode must be the order number placed in the formal environment of the express bird electronic face-to-face order interface; PortName is the printer name, which must be consistent with the local printer name. (3) Ensure that the IP obtained by the GetIp() method in the interface demo is consistent with the computer IP of the user connected to the printer. (4) Install the express bird print control C-Lodop (Print). After calling the express bird batch print demo, you will be prompted to download or download it on the express bird website.
Finally, it will be released online, which can be used after successful docking. After the electronic face sheet interface is called successfully, the interface will directly return to the HTML electronic face sheet template, which can be printed directly by browser or HTML control.
Batch printing process:
1. First call the electronic face sheet printing interface to obtain the required field: ordercode
2. data format of splicing and combination printing: JSON_ Encode ([0 = > ['ordercode' = > 'order No. 1', 'portname' = > 'printer name']);
3. Signature
Required parameters:
(1) . the second part of the spliced data is shown as follows:
Printed data
(2) . ip address of the external network of the host connected to the printer
(3) . APIKey of express bird applied by user
Note: (2) and (3) combination mode: IP Data produces new data and generates a signature with the signature function, as shown in the following figure
The signature code is as follows:
The above processes are included in the official demo. The main points to pay attention to are: if the error returned in the express bird batch printing interface always prompts "data verification fails", it should pay attention to the acquisition of client ip address, the splicing method of signed data and form data, whether the user's appkey and merchant ID are correct, etc;
Here are some points to note
1, Is there any error in the ip acquisition of the printer?
(1) If the test is conducted locally, it is not possible to obtain the local ip address provided by the official. The following code is required:
Get local Internet ip
(2) If it is a formal environment, you can directly use the official demo. The code is as follows:
<?php/** * * Express bird electronic surface single interface * * @ TECHNICAL QQ: 4009633321 * @ TECHNICAL QQ group: 200121393 * @ see: http://www.kdniao.com/MiandanAPI.aspx *@ Copyright: Shenzhen kuaijin Data Technology Service Co., Ltd. * * ID and Key please go to the official website to apply: http://www.kdniao.com/ServiceApply.aspx */ //E-commerce iddefined ('ebusinessid ') or defined ('ebusinessid', 'please apply on the express bird official website http://www.kdniao.com/ServiceApply.aspx ');// The encrypted private key of e-commerce is provided by express bird. Be careful not to disclose the defined ('appkey ') or defined ('appkey', 'please apply on the official website of express bird http://www.kdniao.com/ServiceApply.aspx ');// Request URL, interface official address: http://api.kdniao.cc/api/Eorderservicedefined('ReqURL') or define('ReqURL', 'http://testapi.kdniao.cc:8081/api/Eorderservice '); // Call to get the logistics track / / ---------------------------------------------------- / / construct the electronic face sheet submission information $eorder = []$ eorder["ShipperCode"] = "SF";$ eorder["OrderCode"] = "PM201604062341";$ eorder["PayType"] = 1;$ eorder["ExpType"] = 1; $ sender = [];$ Sender ["name"] = "Mr. Li"$ sender["Mobile"] = "18888888888";$sender["ProvinceName"] = "Mr. Li"$ sender["CityName"] = "Shenzhen"$ sender["ExpAreaName"] = "Futian District"$ sender["Address"] = "SEG Plaza 5401ab"$ receiver = [];$ Receiver ["name"] = "Mr. Li"$ receiver["Mobile"] = "18888888888";$receiver["ProvinceName"] = "Mr. Li"$ receiver["CityName"] = "Shenzhen"$ receiver["ExpAreaName"] = "Futian District"$ receiver["Address"] = "SEG Plaza 5401ab"$ commodityOne = [];$ Commodityone ["goodsname"] = "other"$ commodity = [];$commodity[] = $commodityOne; $eorder["Sender"] = $sender;$eorder["Receiver"] = $receiver;$eorder["Commodity"] = $commodity; // Call electronic face sheet $jsonParam = json_encode($eorder, JSON_UNESCAPED_UNICODE); //$jsonParam = JSON($eorder);// Compatible with PHP5 2 (including) the following echo "electronic face-to-face list interface submission content: < br / >"$ jsonParam;$ jsonResult = submitEOrder($jsonParam); Echo "< br / > < br / > submission result of electronic sheet: < br / >"$ jsonResult; // The returned result of parsing electronic face sheet $result = Json_ decode($jsonResult, true); Echo "< br / > < br / > return code:"$ result["ResultCode"]; If ($result ["resultcode"] = = "100") {echo "< br / > success or not:". $result ["success"];} Else {echo "< br / > electronic order failed";} / / ------------------------------------------------------------------------------ / * ** Query order logistics track by Json * / function submitteorder ($requestdata) {$data = array ('ebusinessid '= > ebusinessid,' requesttype '= >' 1007 ',' requestdata '= > URLEncode ($requestdata),' datatype '= >' 2 '); $data ['datasign'] = encrypt ($requestdata, appkey); $result = sendpost (requrl, $data) ; // According to the information returned from the company's business processing return $result;} /** * post submit data * @ param string $URL request URL * @ param array $data submit data * @ return url response returned HTML * / function sendpost ($URL, $data) {$temps = array(); foreach ($data as $key = > $value) {$temps [] = sprintf ('% s =% s', $key, $value);}$ post_ data = implode('&', $temps); $ url_ info = parse_ url($url); if($url_info['port']=='') { $url_info['port']=80; } echo $url_ info['port']; $ httpheader = "POST " . $ url_ info['path'] . " HTTP/1.0\r\n"; $ httpheader.= "Host:" . $ url_ info['host'] . "\r\n"; $ httpheader.= "Content-Type:application/x-www-form-urlencoded\r\n"; $ httpheader.= "Content-Length:" . strlen($post_data) . "\r\n"; $ httpheader.= "Connection:close\r\n\r\n"; $ httpheader.= $ post_ data; $ fd = fsockopen($url_info['host'], $url_info['port']); fwrite($fd, $httpheader); $ gets = ""; $ headerFlag = true; while (!feof($fd)) { if (($header = @fgets($fd)) && ($header == "\r\n" || $header == "\n")) { break; } } while (!feof($fd)) { $gets.= fread($fd, 128); } fclose($fd); return $gets;} /** * E-commerce Sign signature generation * @ param data content * @ param appkey Appkey * @return DataSign signature * / function encrypt ($data, $appkey) {return URLEncode (base64_encode (MD5 ($data. $appkey));} / *************************************************************************************** Use a specific function to process all elements in the array * @ param string & $array string to process * @ param string $function function to execute * @ return Boolean $apply_ to_ keys_ Whether also is also applied to keys * @ access public * ************************************************************************************** / function arrayrecursive (& $array, $function, $apply_to_keys_also = false) {static $recursive_counter = 0; if (+ $recursive_counter > 1000) {die ('possible deep recurrence attack ');} foreach ($array as $key => $value) { if (is_array($value)) { arrayRecursive($array[$key], $function, $apply_to_keys_also); } else { $array[$key] = $function($value); } if ($apply_to_keys_also && is_string($key)) { $new_key = $function($key); if ($new_key != $key) { $array[$new_key] = $array[$key]; unset($array[$key]); } } } $ recursive_ counter--; } /************************************************************** * * Convert array to Json string (Chinese compatible) * @ param array $array array to convert * @ return string converted Json string * @ access public * *************************************************************************************************************************************** ; return urldecode($Json); } ?> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><! DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd "><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title><script src=" http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js "></script><script type="text/javascript"> $(function(){ $.getJSON('/kdPrintOrderDemo/printOrder', function(data){ $("#EBusinessID").val(data.EBusinessID) $("#RequestData").val(data.RequestData) $("#IsPreview").val(data.IsPreview) $("#DataSign").val(data.DataSign) form1.submit() }) });</ script></head><body> <h1>Demo</h1> <div id="head"></div> <form id="form1" action=" http://www.kdniao.com/External/PrintOrder.aspx " method="post" target="_ self"> <div style=""> <div><input type="text" id="RequestData" name="RequestData" /></div> <div><input type="text" id="EBusinessID" name="EBusinessID" /></div> <div><input type="text" id="DataSign" name="DataSign" /></div> <div><input type="text" id="IsPreview" name="IsPreview " /></div> </div> </form></body></html>
2, Precautions for batch printing and docking of electronic face sheet:
(1) Ensure that the e-commerce ID and key (AppKey) in the interface are completely consistent with the merchant ID and key in the user management background;
(2) OrderCode must be the order number placed in the formal environment of the express bird electronic face-to-face order interface; PortName is the printer name, which must be consistent with the local printer name of the client;
(3) Ensure that the IP obtained by GetIp() method in the interface demo is consistent with the external network IP of the user server (Baidu search IP138).
(4) Install express bird print control C-Lodop (Print)
Installation method 1. After calling the express bird batch printing demo, you will be prompted to download.
Installation method 2. Download it on the official website of express bird,
Special attention should be paid to:
1. If the authorized merchant modifies the main account password, the Access token will become invalid and need to be re authorized. The master account password cannot be modified;
2. The application authorization token is valid for one year.
3. The codes of token and CustomerPwd business unit should be uniquely bound.
Finally, express bird users need to copy and provide the following corresponding information to express bird technical support for configuration:
EBusinessID express bird ID:
AppKey:
App Secret:
token:
CustomerName merchant code / Qinglong Code:
CustomerPwd business department code:
WareHouseID shipping warehouse Code:
Sender's abbreviation:
3, Is there any error in the splicing of data when obtaining the signature?
In the original code, the data is encoded in the form of urlencode and then signed. In the later stage, it seems that there is no need to encode the url, and the request data in the submission form must be added with escape characters