Getting a Delivery Estimate

Syntax

This example shows the syntax:

// This function returns a promise containing a deliveryEstimate
shipiumClient.productView(productId, postalCode, countryCode);

Parameters

This table shows the parameters used:

Parameter (type)

Description

productId (string)

The productId for which a delivery estimate should be provided. This can be any unique identifier such as ISBN or UPC.
Note: You must use a consistent identifier throughout the order and shipment lifecycle.

postalCode (string)

The postal code to be used to calculate a delivery estimate. For US zip codes, zero-padded zip5 strings must be used.

countryCode (string)

The two character Alpha-2 ISO 3166 country code.

Return value (promise)

This example shows the parameters promise returned:

{
    deliveryEstimateDate: '2020-04-08T20:00:00-04:00',
    deliveryEstimateId: 'cf66e167-fcba-4dbd-85fc-bfce8a24bae2',
    customerCountryCode: 'us',
    customerPostalCode: '98110',
    productId: '123456',
    options: {
      shippingOptions: {
        shipOption: 'Standard',
        fromCountry: 'US',
        fromPostalCode: '00000'
      }
    },
    formattedDeliveryEstimateMessage: 'tomorrow at 5:00 PM'
  }

Example usage

This example shows the usage:

// promise 
window.shipiumClient.productView('123456789-12', '98110', 'us').then(function(deliveryEstimate) {   // Get an HTML element to append the delivery message to into 
  var shipiumDiv = document.getElementById("shipium-delivery-estimate"); 
  // Create a text node with the delivery estimate
  var shipiumContent = document.createTextNode('Get it by ' + deliveryEstimate.formattedDeliveryEstimate); 
  // add the text node to the element
  shipiumDiv.appendChild(shipiumContent);
});

📘

More information on the API responses

As with all Shipium API responses, this API follows the API Response Codes standards unless otherwise specified.


Did this page help you?