I had a question roll through on the WooCommerce Slack, which I think could be of assistance to our readers –

When shipping using Canada Post, the majority of orders go from CA to USA. So there needs to be a “customs declaration” form for each order. Apparently this “customs declaration” form is somewhere readily available in the Canada Post account. How do I know?

Well, the client is sick and tired of having to bounce back and forth for every order and jumping back into the Canada Post dashboard just to retrieve the “customs declaration” form. Is there a way to ‘pull’ this info from the Canada Post API?

Lol, somewhat dramatic – anyhow, it’s completely possible. Thanks to the helpful folks at Canada Post, here is a guide on how to get it done.

Via the API, Canada Post always return the custom forms for USA/Intl destination. It can be combined with the shipping labels, or in some instances it comes separately. This is where it becomes important to make available all copies when you get an answer back from Createshipments. It would require also that on the front end, you offer the capability for the end user to fill in the customs information.

Reference:
Soap: shipping web service : https://www.canadapost.ca/cpo/mc/business/productsservices/developers/services/shippingmanifest/soap/createshipment.jsf
Rest: shipping web service : https://www.canadapost.ca/cpo/mc/business/productsservices/developers/services/shippingmanifest/createshipment.jsf

Below are 2 examples where you see the customs info combined with the shipping labels. The 2nd example shows where it is a separate copy. It all depends on the shipping service and paper format opted for.

#1 Xpresspost USA (Canada Post combines the custom info on the shipping label)

Notice the answer, we only one instance of the endpoint name : LABEL

<root>
<shipment-info xmlns="http://www.canadapost.ca/ws/shipment-v4"><shipment-id>383611490629946833</shipment-id><shipment-status>created</shipment-status><tracking-pin>EM070235895CA</tracking-pin><links><link rel="self" href="https://soa-gw.canadapost.ca/rs/0004567/0004567/shipment/383611490629946833" media-type="application/vnd.cpc.shipment-v4+xml"/><link rel="details" href="https://soa-gw.canadapost.ca/rs/0004567/0004567/shipment/383611490629946833/details" media-type="application/vnd.cpc.shipment-v4+xml"/><link rel="price" href="https://soa-gw.canadapost.ca/rs/0004567/0004567/shipment/383611490629946833/price" media-type="application/vnd.cpc.shipment-v4+xml"/><link rel="group" href="https://soa-gw.canadapost.ca/rs//0004567/0004567/shipment?groupId=PICKUP" media-type="application/vnd.cpc.shipment-v4+xml"/><link rel="label" href="https://soa-gw.canadapost.ca/rs/artifact/0185703c30xxxxx/10017530553/0" media-type="application/pdf" index="0"/></links></shipment-info></root>

Result:
Xpresspost USA Sample

#2 Here is an example where Canada Post returns 2 labels, one outgoing and the second is a commercial invoice needed with the shipments for customs purposes.

Answer from Canada Post:

<?xml version="1.0"?>
<root>
<shipment-info xmlns="http://www.canadapost.ca/ws/shipment-v4"><shipment-id>384861490630238430</shipment-id><shipment-status>created</shipment-status><tracking-pin>304611863552</tracking-pin><links><link rel="self" href="https://soa-gw.canadapost.ca/rs/0004567/0004567/shipment/384861490630238430" media-type="application/vnd.cpc.shipment-v4+xml"/><link rel="details" href="https://soa-gw.canadapost.ca/rs/0004567/0004567/shipment/384861490630238430/details" media-type="application/vnd.cpc.shipment-v4+xml"/><link rel="price" href="https://soa-gw.canadapost.ca/rs/0004567/0004567/shipment/384861490630238430/price" media-type="application/vnd.cpc.shipment-v4+xml"/><link rel="group" href="https://soa-gw.canadapost.ca/rs/0004567/0004567/shipment?groupId=PICKUP" media-type="application/vnd.cpc.shipment-v4+xml"/><link rel="label" href="https://soa-gw.canadapost.ca/rs/artifact/0185703c30xxxx/10017531513/0" media-type="application/pdf" index="0"/><link rel="commercialInvoice" href="https://soa-gw.canadapost.ca/rs/artifact/0185703c30xxxx/10017531514/0" media-type="application/pdf" index="0"/></links></shipment-info></root>

When receiving the answer back from Canada Post, I always read the entire answer back using for each, so I can capture everything back from Canada Post and translate in a button:

Canada Post Admin

Here is the printout of the second test showing 2 different copies for this shipment:

Canada Post FedEx Sample

Canada Post Invoice

There you have it folks. Thanks again to the team at Canada Post for helping to put this together.