CEVA Logistics has acquired the Shipwire business to become the world's 5th largest logistics provider.

XML Shipping Rate API FAQ

Use our XML shipping rate request and response Web services calls to integrate shipping rates, from Shipwire or Shipwire Anywhere warehouses, to your buyers, directly into your e-commerce applications. This means instant quotes automatically from the warehouse closest to each customer!

 

How does international shipping work?

We are going to answer this by looking at valid shipping methods that can be used. In OrderList.dtd there is the example:

Example: <Shipping>1D</Shipping> Example: <Shipping>2D</Shipping> Example: <Shipping>GD</Shipping> Example: <Shipping>E-INTL</Shipping> Example: <Shipping>INTL</Shipping> Example: <Shipping>PL-INTL</Shipping> Example: <Shipping>PM-INTL</Shipping>

A given order can be either domestic (shipping warehouse and customer are in the same country) or international (shipping warehouse and customer are in different countries).

“GD”, “2D”, and “1D” are domestic shipping methods corresponding to Ground (deferred), two-day, and overnight shipping, respectively.

“E-INTL”, “INTL”, “PL-INTL”, and “PM-INTL” correspond to economy, standard, plus, and premium classes of international shipping. Economy shipping methods are more cost-effective at the expense of longer delivery times and less detailed tracking information. Not all international shipping methods are available to all destinations. Generally, the “E-INTL” option returned by our API will be the cheapest service that meets the merchant’s preferences/expectations (e.g. with respect to insurability and trackability). While merchants can manually choose a faster international service in our application, we do not yet support discrete internationall service levels through the rating API.

We decide the optimal warehouse on a per-order basis. Since the shopping cart won’t know ahead of time whether the optimal shipping warehouse for an order will be domestic or international, you should be prepared to show any of the above shipping method options for an order.

 

Can you show a code example for a Rate Request?

Here is a simple Rating Request PHP example:
$account_email = 'email@address.com'; // SW account API username
$account_password = 'password'; // SW account password

// gather ship-to address data
$address_street1 = 'address1';
$address_street2 = ' address2';
$address_city = 'city';
$address_region = 'state';             // use 2 letter ISO code when possible
$address_country = 'country';    // Use ISO 2 letter code
$address_postcode = 'postal_code';

// loop through cart items
$items = $requestVar->all_items;

$item_xml = '';
$num = 1;
if (count($items) > 0) {
foreach ($items as $item) {
$item_xml .= '<Item num="' . $num++ . '">';
$item_xml .= '<Code>' . htmlentities($item->sku) . '</Code>';
$item_xml .= '<Quantity>' . htmlentities($item->qty) . '</Quantity>';
$item_xml .= '</Item>';
}
}

$xml = '
<RateRequest>
<EmailAddress><![CDATA[' . $account_email . ']]></EmailAddress>
<Password><![CDATA[' . $account_password . ']]></Password>
<Order id="quote123">
<Warehouse>00</Warehouse>
<AddressInfo type="ship">
<Address1><![CDATA[' . htmlentities($address_street1) . ']]></Address1>
<Address2><![CDATA[' . htmlentities($address_street2) . ']]></Address2>
<City><![CDATA[' . htmlentities($address_city) . ']]></City>
<State><![CDATA[' . htmlentities($address_region) . ']]></State>
<Country><![CDATA[' . htmlentities($address_country) . ']]></Country>
<Zip><![CDATA[' . htmlentities($address_postcode) . ']]></Zip>
</AddressInfo>
' . $item_xml . '
</Order>
</RateRequest>';

$xml_request_encoded = ("RateRequestXML=" . $xml);

$xml_submit_url = "https://api.shipwire.com/exec/RateServices.php";

$session = curl_init();
curl_setopt($session, CURLOPT_URL, $xml_submit_url);
curl_setopt($session, CURLOPT_POST, true);
curl_setopt($session, CURLOPT_HTTPHEADER, array("Content-type","application/x-www-form-urlencoded"));
curl_setopt($session, CURLOPT_POSTFIELDS, $xml_request_encoded);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($session, CURLOPT_TIMEOUT, 360);
$response = curl_exec($session);
 

How many rates will Shipwire respond with?

When you use the shipping rate API to request a shipping rate your system will tell Shipwire that you want a rate for a specific shipping method (ID, 2D, GD…). Shipwire will respond with only 1 shipping rate. This shipping rate will be the match after Shipwire looks up the shipping rates with the carriers and the shipping preferences of the merchant.

 

How to send a rate request to Shipwire?

The shipping rate API is the best way to accomplish this. So you are in the right place.

 

What should we send across in the referrer field?

You can ignore this and still submit a valid API request.

 

How should my address Country and State/Province information be provided?

For best results the Country address information must be provided using the proper two letter ISO  Country Code.   In addition when possible the proper State or Province abbriviation should be used as well.

 

What if the merchant has multiple fulfillment centers?

Shipwire returns shipping rates today for products in our warehouses that we have a matching SKU for. Some merchants may carry the same product with Shipwire and in their own warehouse. As of today we don’t pass shipping rates for non-Shipwire held products. We know this is a complex situation so let us know your concerns by e-mailing your thoughts to: partner (at) shipwire (dot) com.

To work around this issue please consider the following:

  1. Can you give the merchant the ability to choose a shipping rate mechanism by product ID/SKU ID? This method will allow even the most complex multi-vendor/shipper merchant to be able to display rates for products they ship from their home warehouse; include Shipwire rates; and, potentially put in rates for other options (example a drop shipped product that they flat rate bill)
  2. Potentially coach the merchant to keep their Shipwire fulfilled product/SKU ID’s distinct from their self-fulfilled products.