Setting up Canada Post real-time shipping calculator
To set up shipping cost calculation through Canada Post real-time shipping calculator:
1. If you haven't yet done so, provide your own company address in the 'General settings->Company options' section. Make sure you provide this address correctly - it will be submitted to the real-time shipping calculator as the origin address for all shipments from your store and thus will affect the shipping rates.
2. Obtain an account with Canada Post (Sign up at http://www.canadapost.ca/).
3. In your store's Admin area, go to the 'General settings->Shipping options' page and enable Canada Post:
- Select the check box Enable real-time shipping calculation.
- Make sure the check box Use InterShipper calculation service is not selected.
- In the CanadaPost API Key subsection, provide the following information:
- X-Cart v4.6 and later:
- The below API Key is for: Select Development or Production based on whether you will be using Canada Post in Development or Production mode. Depending on your selection, you will be supposed to enter the respective type of API key in the fields below.
- CanadaPost username and CanadaPost password: Enter the API key you obtained from Canada Post. To learn about API keys, click here.
- Earlier X-Cart versions:
- CanadaPost merchant ID: Enter the merchant ID you obtained from Canada Post.
4. Adjust Canada Post options:
- a. Go to the 'Shipping methods' section of your store's Admin area (Shipping and Taxes menu->Shipping methods).
- b. On the list of real-time shipping methods, find Canada Post and click the Options >> link opposite it. A dialog box with Canada Post options opens.
- c. Adjust the options.
Notes on Canada Post options for X-Cart 4.6.0:
- The customer number of the owner of the mail (mailed on behalf of customer). (up to 10 digits)(required): Your Canada Post commercial customer number. This value is required. Important: The customer number must be entered without the leading zeros. For example, if the Customer Number in your Canada Post account says "0001234567", you must enter just "1234567".
- Omit the element for non-contract rates or provide the contract number for commercial (contracted) rates. (up to 10 digits)(optional): Your contract number. This must be provided for commercial (contracted) rates, if exists. Leave empty for non-contract rates.
- Either commercial or counter. (quote-type): Choose "commercial" to get contracted rates (as contracted between you and Canada Post). Choose "counter" to get rates you'd get over the counter (without a customer or contract number).
- d. Click the Apply button.
That is all. Now you can test whether your store can receive real-time shipping rates correctly. For details, see X-Cart:Testing Your Store's Ability to Receive Real-time Shipping Rates page.
Shipping in multiple packages
X-Cart now provides a packaging algorithm that allows splitting an entire purchase into multiple packages that fit certain limitations (maximum package weight and dimensions). This algorithm allows to get real-time shipping rates even when the cart contains a large quantity of products with the total weight and dimensions exceeding the values allowed for a single package.
With the Dimensional Shipping feature, you can specify dimensions for each product you have got at your store (See the Product details page) and use those dimensions for calculating shipping rates using the on-line shipping rate calculation service.
For more information, please refer to Setting Up Dimensional Shipping.
When testing real-time shipping rates calculation, I am getting the following error from Canada Post:
X-Cart HTTPS: libcurl error(7): couldn't connect to host
To get the Canada Post rates, X-Cart sends requests from your server to sellonline.canadapost.ca (Canada Post's server) via port 30000. If outgoing connections via port 30000 are not allowed on your server, it will cause the error in question.
To fix this issue contact your hosting support or the server admins, and ask them to allow outgoing connections via port 30000.
Script to test connection to Canada Post's server via port 30000
- Download the File:Test connection to canadapost.php.txt, save the downloaded file as 'test_connection_to_canadapost.php'.
- Upload test_connection_to_canadapost.php to your web server's document root.
- Use the following URL to test: