Canada Post - Sell Online Developer's Site
Direct Connection - Interface Description
This page describes how to send a request to the Sell Online server.
The communication between the Sell Online server and your application must be done using HTTP(S) POST protocol.
Your application must perform the following tasks:
(Note that the communications aspect of the transaction can be done by sending an HTTP(S) POST request with the XML request. An example is provided at
- Build the XML request (string) from:
- the merchant ID assigned by Canada Post
- the destination address
- the list of items (weight and dimension) in the consumer's shopping cart
The format of the XML request is defined in our DTD (eParcel.dtd)
Examples of XML request can be found here (SampleRequest.xml)
and can be reused.
Note the following concerning the format of the XML request:
- Provide at least a space between 2 tags if there is no other information.
- The & character has special meanings in XML. It is used to encode Unicode
characters. If the character is used for other purposes (ex. if it is provided
in the item description) it will most likely cause a parsing problem and your
request will not go through.
- Do not provide optional fields if you do not use them.
- The following fields are required by the system to process the request
for each destination (the other ones, if not used, must comply with point 1 above):
- For Canadian shipments, the country and postal code are required.
- For US shipments, the country and state fields are required.
- For international shipments, only the country field is required.
- Send the XML request to Sell Online by using an HTTP(S) POST request.
- Receive the response from the server as an XML (or HTML, see below) document.
- The format of the XML response is defined in our DTD (eParcel.dtd)
- An example of successful XML response can be found here (SampleResponse.xml).
- An example of response including the empty space calculation can be found here (SampleResponseEmptySpace.xml).
- An example of error can be found here (SampleError.xml).
- The full list of return codes can be found here.
- Each shipping option is assigned a product id (integer). The list of supported ids can be found here.
You may receive the response directly in HTML format. With this method, you directly
embedd the HTML response in your HTML page.
If you need more information, please download the documentation
and look at our sample written in ASP
- Parse the XML response using your preferred XML parser.
- Display the shipping options to the clients as shown.
- We recommend you to use the display format that can be found at this URL.
To help you in testing your application, we highly recommend you a
list of "Test Cases"
that your application should pass to confirm that the Sell Online integration
is working and that you have your shipping profile setup correctly for your business
Summary of Input / Output parameters
The input and output variables are described in the diagram below.
Those with * are optional.