Non-Contract Shipping

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

Get Non-Contract Shipment Receipt – REST

Summary

Name: Get Non-Contract Shipment Receipt
Reason to Call: This call is used to get the label charges and settlement information in XML format. The data in the response can be formatted to print a credit card receipt.
Input: Shipment Id
Output: XML receipt details
Typical Prior Call: Create Non-Contract Shipment or Get Non-Contract Shipment
Typical Next Call: Get Artifact or Create Non-Contract Shipment
Version history: Release notes

Request Details

Request – Structure for Get Non-Contract Shipment Receipt

Endpoint

GET https://XX/rs/{mailed by customer}/ncshipment/{shipment id}/receipt

Replace... With...

XX (Development)

ct.soa-gw.canadapost.ca

XX (Production)

soa-gw.canadapost.ca

{mailed by customer}

your customer number*

{shipment id}

the appropriate shipment ID*

*The link provided by Create Non-Contract Shipment or Get Non-Contract Shipment will replace {mailed by customer} with your customer number and
{shipment id} with the appropriate shipment ID.

HTTP Headers

HTTP Header Variable

Value

Accept

application/vnd.cpc.ncshipment-v4+xml (Note: */* in place of the header value will return an error)

Content-Type

application/vnd.cpc.ncshipment-v4+xml (Note: */* in place of the header value will return an error)

Authorization

Basic {Base64 encoding of userid:password}

Accept-language

en-CA or fr-CA

Body

<?xml version="1.0" encoding="utf-8"?>
<non-contract-shipment-receipt xmlns="http://www.canadapost.ca/ws/ncshipment-v4">
xxx
</non-contract-shipment-receipt>

Request – Elements

The Get Non-Contract Shipment Receipt service does not require any XML input data.

Response Details

Response – Elements

Get Non-Contract Shipment Receipt – Response Elements
Element Name Type Description

non-contract-shipment-receipt

Complex

This is the top level of the XML response structure.

final-shipping-point

Simple

This is the Postal Code of the Post Office where the shipment is to be dropped off.

shipping-point-name

Simple

This is the descriptive name of the shipping point.

shipping-point-id

Simple

This is the Canada Post identification number of the shipping point.

mailed-by-customer

Simple

This is the 10-digit customer number of the mailed by customer.

cc-receipt-details

Complex

This structure contains details required for a credit card receipt.

merchant-name

Simple

Will have the value: “Canada Post”

merchant-url

Simple

Will have the value: “www.canadapost.ca”

name-on-card

Simple

The name on the default credit card stored by Canada Post.

auth-code

Simple

The authorization code received from the credit card issuer.

auth-timestamp Simple

Date and time that the authorization was obtained.
The date and time are specified in standard XML date/time format: "YYYY-MM-DDThh:mm:ss" where:

  • YYYY indicates the year
  • MM indicates the month
  • DD indicates the day
  • T indicates the start of the required time section
  • hh indicates the hour
  • mm indicates the minute
  • ss indicates the second

card-type

Simple

The type of card used for the purchase.

Must have one of the following values:
- MC
- VIS
- AME

charge-amount

Simple

The total amount charged to the credit card for the shipping service / label.

currency

Simple

The currency of the transaction: CAD

transaction-type

Simple

The type of credit card transaction: Sale

service-code Simple

This is the Canada Post delivery service used for shipping the item.

May be any of:

Service-Code Description
Domestic
DOM.RP Regular Parcel
DOM.EP Expedited Parcel
DOM.XP Xpresspost
DOM.PC Priority
USA
USA.XP Xpresspost USA
USA.EP Expedited Parcel USA
USA.SP.AIR Small Packet USA Air
USA.SP.SURF Small Packet USA Surface
International
INT.XP Xpresspost International
INT.SP.AIR Small Packet International Air
INT.SP.SURF Small Packet International Surface

Contained within non-contract-shipment-receipt.

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

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

This is the adjustment code indicating which adjustment is applied to this shipment.

adjustment-amount

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.

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-transit-time

Simple

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

expected-delivery-date

Simple

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 Canada Post’s calculation and your declaration.

Response – XML Diagram

The following diagram shows the XML structure of the response from the Get Non-Contract Shipment Receipt service.

Get Non-Contract Shipment Receipt – Structure of the XML Response
Get Non-Contract Shipment Receipt – Structure of the XML Response

Response – Possible Error Responses

Errors are not expected for invocation of this link provided by Create Non-Contract Shipment or Get Non-Contract Shipment. However, for general error responses see HTTP status codes.

Examples

Sample REST XML Request – Get Non-Contract Shipment Receipt

There is no XML related to this REST request. Use the link provided by a prior request or see the soapUI project files for request examples.

Sample REST XML Response – Get Non-Contract Shipment Receipt

<non-contract-shipment-receipt>
<final-shipping-point>J4W4T0</final-shipping-point>
<shipping-point-name>BP BROSSARD</shipping-point-name>
<shipping-point-id>0192</shipping-point-id>
<mailed-by-customer>0001111111</mailed-by-customer>
<service-code>DOM.EP</service-code>
<rated-weight>15.000</rated-weight>
<base-amount>18.10</base-amount>
<pre-tax-amount>19.46</pre-tax-amount>
<gst-amount>0.00</gst-amount>
<pst-amount>0.00</pst-amount>
<hst-amount>2.53</hst-amount>
<priced-options>
<priced-option>
<option-code>DC</option-code>
<option-price>0</option-price>
</priced-option>
</priced-options>
<adjustments>
<adjustment>
<adjustment-code>FUELSC</adjustment-code>
<adjustment-amount>1.36</adjustment-amount>
</adjustment>
</adjustments>
<cc-receipt-details>
<merchant-name>Canada Post Corporation</merchant-name>
<merchant-url>www.canadapost.ca</merchant-url>
<name-on-card>John Doe</name-on-card>
<auth-code>076838</auth-code>
<auth-timestamp>2012-03-13T08:27:20-05:00</auth-timestamp>
<card-type>VIS</card-type>
<charge-amount>21.99</charge-amount>
<currency>CAD</currency>
<transaction-type>Sale</transaction-type>
</cc-receipt-details>
<service-standard>
<am-delivery>false</am-delivery>
<guaranteed-delivery>true</guaranteed-delivery>
<expected-transit-time>1</expected-transit-time>
<expected-delivery-date>2012-03-14</expected-delivery-date>
</service-standard>
</non-contract-shipment-receipt>