WeSupply

Estimate Delivery Date

There are two types of estimations possible in WeSupply:. Estimations based on WeSupply Averages Estimations based on Shipper Replies For both of these estimations you will need to get access token as follows:. Generate Token. "client_credentials", "client_id" = ‘your_client_id’, "client_secret" = 'your_client_secret');$curl = curl_init();curl_setopt_array($curl, array( CURLOPT_URL = $url, CURLOPT_RETURNTRANSFER = true, CURLOPT_ENCODING = "", CURLOPT_MAXREDIRS = 10, CURLOPT_TIMEOUT = 30, CURLOPT_HTTP_VERSION = CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST = "POST", CURLOPT_POSTFIELDS = http_build_query($clienttoken_post), CURLOPT_HTTPHEADER = array( "cache-control: no-cache", "content-type: application/x-www-form-urlencoded" ),));$response = curl_exec($curl);$err = curl_error($curl);curl_close($curl);if ($err) { echo "cURL Error #:" . $err;} else { echo $response;}?. Estimations based on WeSupply Averages . To get estimations based on WeSupply Averages, you will need to provide a list of parameters as follows:. ipAddress - the ip address of the customer (used to identify the customer’s delivery address post code) supplierId - the id of the store from where the purchase is done postcode - the post code of the customer, if empty the ipAddress will be used to identify the customer post code Example of call:. . . $accesToken = 'previously_generated';. $params = array('ipAddress' = '91.204.211.38', 'supplierId' = '1', 'postcode' = '');. $buildQuery = http_build_query($params);. $url = 'https://wesupply_client_url/api/estimations?'.$buildQuery;. $curl = curl_init();. curl_setopt_array($curl, array(. CURLOPT_URL = $url,. CURLOPT_RETURNTRANSFER = true,. CURLOPT_ENCODING = "",. CURLOPT_MAXREDIRS = 10,. CURLOPT_TIMEOUT = 30,. CURLOPT_HTTP_VERSION = CURL_HTTP_VERSION_1_1,. CURLOPT_CUSTOMREQUEST = "GET",. CURLOPT_FOLLOWLOCATION = TRUE,. CURLOPT_HTTPHEADER = array("Authorization: Bearer $accesToken"). ));. $response = curl_exec($curl);. $err = curl_error($curl);. curl_close($curl);. if ($err) {. echo "cURL Error #:" . $err;. } else {. echo $response;. }. You will receive a JSON Object response as follows:. {. "zip":"ME9 8PX",. "country":"United Kingdom",. "processing_estimate":15690,. "delivery_estimate":12490,. "endtoend_estimate":28180. } Zip and country response params are based on the ip location identification. Processing, delivery and end to end estimations represent the average times of each order step placed today in the last 4 weeks and the values are expressed in seconds. Estimations based on Shipper replies. To get estimations based on Shipper replies, you will need to provide a list of parameters as follows:. ipAddress - the ip address of the customer (used to identify the customer’s delivery address post code) supplierId - the id of the store from where the purchase is done postcode - the post code of the customer, if empty the ipAddress will be used to identify the customer post code countrycode - the country code of the customer ( must be 2 letter ISO code ex: US, GB, DE, IT ... ), if empty, the ipAddress will be used to identify the customer country code price - total price in cart currency - currency of your store carriers - a list of all available shippers from your store;. Available shippers at this moment are: UPS, USPS, FedEx, Shippo, & EasyPost. . $accesToken = 'previously_generated';. $carriers = array('UPS');. $params = array('ipAddress' = '91.204.211.38', 'supplierId' = '1', 'postcode' = '', 'price' = '300.0000', 'currency' = 'USD', 'carriers' = $carriers);. $buildQuery = http_build_query($params);. $url = 'https://wesupply_client_url/api/shippingQuotes?'.$buildQuery;. $curl = curl_init();. curl_setopt_array($curl, array(. CURLOPT_URL = $url,. CURLOPT_RETURNTRANSFER = true,. CURLOPT_ENCODING = "",. CURLOPT_MAXREDIRS = 10,. CURLOPT_TIMEOUT = 30,. CURLOPT_HTTP_VERSION = CURL_HTTP_VERSION_1_1,. CURLOPT_CUSTOMREQUEST = "GET",. CURLOPT_FOLLOWLOCATION = TRUE,. CURLOPT_HTTPHEADER = array("Authorization: Bearer $accesToken"). ));. $response = curl_exec($curl);. $err = curl_error($curl);. curl_close($curl);. if ($err) {. echo "cURL Error #:" . $err;. } else {. echo $response;. }. You will receive a JSON Object response as follows:. {. "UPS":{. "1DM":1542758400,. "1DA":1542758400,. "1DP":1542758400,. "GND":1542758400. }. }. For each carrier requested you will receive a list of services and estimation arrival date for that service in timestamp format.
Was this article helpful?

Still puzzling over something?

The agent has read this article — and everything around it. Ask a follow-up and it answers in seconds.