Contract Shipping

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

Get Shipment Receipt – REST

Summary

Name: Get Shipment Receipt
Reason to Call: Used to get settlement information in XML format for a shipment where no manifest is required that was paid by credit card or Supplier Account. The data in the response can be formatted to print a receipt.
Input: Invoke the link returned from Create Shipment or Get Shipment call where rel= “receipt”
Output: The credit card or Supplier Account authorization details in XML format.
Error Example: Not found (which can also happen if shipment was not paid by credit card).
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 Receipt – Summary of Service

Get Shipment Receipt – Summary of Service

Request Details

Request – Structure for Get Shipment Receipt

Endpoint

Invoke the link returned from a prior call where rel= “receipt” (see Provided endpoints)

HTTP Headers

HTTP Header Variable

Value

Accept

application/vnd.cpc.shipment-v8+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

None

Request – Elements

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

Response Details

Response – Elements

The following table describes the top level view of the XML data in the response.

Get Shipment Receipt – Response Elements
Element Name Type Description

shipment-receipt

Complex

The top level XML structure for the response.

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

The date and time that the credit card company authorized the transaction.

card-type

Simple

The type of credit card used for the purchase.

charge-amount

Simple

The total amount charged to the credit card.

currency

Simple

The currency of the transaction: CAD

transaction-type

Simple

Will have the value: "Sale"

supplier-account-receipt-details

Complex

This structure will be provided only if the shipment was paid by Supplier Account.
This structure is not returned in the sandbox environment.

merchant-name

Simple

Will have the value: "Canada Post".

merchant-url

Simple

Will have the value: "www.canadapost.ca".

auth-code

Simple

The authorization code received from the supplier.

auth-timestamp

Simple

The date and time the supplier authorized the transaction.

supplier-id

Simple

The supplier that authorized the transaction. Values are:

  • FP = FrancoTyp Postalia
  • NE = Neopost
  • PB = Pitney Bowes

charge-amount

Simple

The total amount charged to the account.

currency

Simple

The currency of the transaction; always CAD.

transaction-type

Simple

Will have the value: "Sale".

Response – XML Diagram

Get Shipment Receipt – Structure of XML Response

Get Shipment Receipt – Structure of XML Response

Response – Possible Error Response

In the case of an application error, the XML body will have an error message structure rather than the success response, but the HTTP code will be 200. For more information, see HTTP status codes.

Examples

Sample REST XML Request – Get Shipment Receipt

GET https://XX/rs/1234567/1234567/shipment/123456789012345678/receipt
Accept:application/vnd.cpc.shipment-v8+xml
Authorization:Basic s7HD7gwsennesc==

Note: the HTTP endpoint link and “Accept” value should not be hardcoded. Rather, these values are provided as outputs from the Create Shipment and Get Shipment services.

Sample REST XML Response – Get Shipment Receipt

<shipment-receipt>
<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>2013-06-17T08: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>
</shipment-receipt>