Contract Shipping

Code Samples for Contract Shipping: Java (.zip) | PHP (.zip) | C# (.zip)

Get Shipment Price – SOAP

Summary

Name: Get Shipment Price
Reason to Call: To retrieve shipment price information from a previously created shipment.
Input: Mailed-by; shipment-id; locale (optional)
Output: The price details in an XML format, with options and taxes being separately described.
Error Example: Address invalid, weight exceeds 30 kg
Typical Prior Call: Create Shipment or Get Shipment
Typical Next Call: Create Shipment (to continue creating shipments)
Optional Next Call: Get Artifact or Get Shipment Details (if those services have not already been called)
Version history: Release notes
Get Shipment Price – Summary of Service

Get Shipment Price – Summary of Service

Call Details

WSDL: shipment.wsdl
Endpoint (Development): https://ct.soa-gw.canadapost.ca/rs/soap/shipment/v8
Endpoint (Production): https://soa-gw.canadapost.ca/rs/soap/shipment/v8
Namespace: http://www.canadapost.ca/ws/soap/shipment/v8
Operation: GetShipmentPrice

SOAP Body

This section describes the XML input elements to this service. For the hierarchical structure, see the XML diagram.

Get Shipment Price – Request Elements
Element Name Type Required / Optional Description

get-shipment-price-request

complex

required

The top level XML element for the request input information.

mailed-by

simple

required

(1-10 digit numeric)

The 10-digit customer number of the mailed-by customer.

If the number provided has fewer than 10 digits, the system will add leading zeros.

mobo

simple

optional

(1-10 digit numeric)

The 10-digit customer number of the mailed-on-behalf-of customer.

If this element is missing, it will default to the mailed-by customer number.

If the number provided has fewer than 10 digits, the system will add leading zeros.

locale

simple

optional

Indicates your language preference for receiving error messages.

EN = English
FR = French

If no value is provided, the default language is English.

shipment-id

simple

required

(Alphanumeric String – up to 32 letters/digits)

An identification number representing the existing shipment for which information is being requested.

Note: Retrieve the shipment-id provided by previous calls to Create Shipment or Get Shipment. The output of those services will include a shipment-id element.

Request – XML Diagram

Get Shipment Price – Structure of the XML Request

Get Shipment Price – Structure of the XML Request

Response Details

Response – Elements

The following table describes the XML elements in the response to Get Shipment Price. For the hierarchy of the response, see the
XML diagram.

Get Shipment Price – Response Elements
Element Name Type Description

get-shipment-price-response

complex

The top level XML element for the response.

It will either contain the results of a successful completion, or the error structure.

shipment-price

complex

The XML structure containing the results of a successful completion of the service.

service-code

simple

This identifies the delivery service-code used for delivery of the shipment.

The most frequently used codes are listed below.

Code Description
DOM.RP Regular Parcel
DOM.EP Expedited Parcel
DOM.XP Xpresspost
DOM.PC Priority
DOM.LIB Library Materials
USA.EP Expedited Parcel USA
USA.SP.AIR Small Packet USA Air
USA.TP Tracked Packet – USA
USA.TP.LVM Tracked Packet – USA (LVM)
(large volume mailers)
USA.XP Xpresspost USA
INT.XP Xpresspost International
INT.IP.AIR International Parcel Air
INT.IP.SURF International Parcel Surface
INT.SP.AIR Small Packet International Surface
INT.TP Tracked Packet – International

(Note: These delivery services and their codes can be discovered by calling the Get Rates or Discover Services web services described in Rating)

base-amount

simple

This is the base amount cost for shipping in $CAD.

priced-options

complex

This structure contains the list of options applied to this shipment and the associated price impact.

This will be absent if there are no options applied to the price of this shipment.

priced-option

complex

May occur 1 … N times.

Each occurrence is a structure that represents a shipping option that applies to the shipment, and which may affect the price of the shipment.

option-code

simple

This is the option code for an option applied to this shipment.

Option code examples are as follows

COD – Collect on delivery.
COV – Insurance coverage.
CYL – Mailing tube.
DC – Delivery confirmation.
PA18 – Proof of age 18 years.
PA19 – Proof of age 19 years.
SO – Signature option.
UP – Unpackaged.

option-price

simple

This is the total component of the price that is attributable to the option. Units are $CAD.

adjustments

complex

This structure contains the list of adjustments applied to this shipment and the associated price impact.

This will be absent if there are no adjustments applied to the price of this shipment.

adjustment

complex

May occur 1 … N times.

This structure represents a shipping adjustment that applies to the shipment, and which may affect the price of the shipment.

adjustment-code

simple

The code indicating which adjustment is applied to this shipment:

  • AUTDISC – Automation discount
  • FUELSC – Fuel surcharge
  • V1DISC – Solutions for Small Business savings
  • PROMODISC – Promotional discount (if the promo code is invalid or expired, the discount amount will show as zero under adjustment-amount)
  • PLATFMDISC – Discount for using an e-commerce platform
  • NEWREGDISC – Discount for joining the Developer Program
  • ORIGSC – Service area adjustment (at origin)
  • DESTSC – Service area adjustment (at destination)
  • PURFEE – Fee charged for using a label before it was paid for (i.e., before performing Transmit Shipments)
  • SAADJ – Service area adjustment (rate adjustment up or down for specific source and destination postal code combinations)

adjustment-amount

simple

This is the total cost attributable to the adjustment.

pre-tax-amount

simple

This is the pre-tax total amount of the shipment cost.

gst-amount

simple

This is the amount of the GST added to the base cost.

pst-amount

simple

This is the amount of the PST added to the base cost.

hst-amount

simple

This is the amount of the HST added to the base cost.

due-amount

simple

This is the total amount due for the shipment.

service-standard

complex

This structure represents the service standard to which this shipment will be delivered.

am-delivery

simple

{true, false}

This indicates whether morning delivery is part of the service standard.

guaranteed-delivery

simple

{true, false}

This indicates whether guaranteed delivery is part of the service standard.

expected-transmit-time

simple

This indicates the number of days the package is expected to be in the mail stream from induction to delivery.

*Should be “expected-transit-time” due to a typo, it will be fixed in the next version

expected-delivery-date

simple

(YYYY-MM-DD date format)

This indicates the estimated delivery date based from the creation date of the shipment or the expected mailing date provided in the “create” request if greater.

rated-weight

simple

This indicates the actual weight or volumetric equivalent used to determine the base price, within the prescribed weight and size limits of the specific product, on the greater of actual weight or volumetric equivalent of actual weight.

Response – XML Diagram

Response – Possible Error Response

The response to error conditions for this web service follows the standard SOAP error response approach used for all Canada Post web services. For more information, see SOAP Fundamentals of Canada Post Web Services.

Examples

Sample SOAP XML Request – Get Shipment Price

<get-shipment-price-request>
<mailed-by>1111111</mailed-by>
<locale>EN</locale>
<shipment-id>340531309186521749</shipment-id>
</get-shipment-price-request>

Sample SOAP XML Response – Get Shipment Price

<get-shipment-price-response>
<shipment-price>
<service-code>DOM.EP</service-code>
<base-amount>12.92</base-amount>
<priced-options>
<priced-option>
<option-code>DC</option-code>
<option-price>0</option-price>
</priced-option>
</priced-options>
<adjustments>
<adjustment>
<adjustment-code>AUTDISC</adjustment-code>
<adjustment-amount>0.00</adjustment-amount>
</adjustment>
<adjustment>
<adjustment-code>FUELSC</adjustment-code>
<adjustment-amount>1.29</adjustment-amount>
</adjustment>
</adjustments>
<pre-tax-amount>21.71</pre-tax-amount>
<gst-amount>0.00</gst-amount>
<pst-amount>0</pst-amount>
<hst-amount>2.82</hst-amount>
<due-amount>24.53</due-amount>
<service-standard>
<am-delivery>false</am-delivery>
<guaranteed-delivery>true</guaranteed-delivery>
<expected-transmit-time>1</expected-transmit-time>
<expected-delivery-date>2011-09-22</expected-delivery-date>
</service-standard>
<rated-weight>110</rated-weight>
</shipment-price>
</get-shipment-price-response>