Non-Contract Shipping

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

Request Non-Contract Shipment Refund – REST

Summary

Name: Request Non-Contract Shipment Refund
Reason to Call:

To request a refund for a shipment /label that you created in error. You can only request a refund for a shipment that has not been sent and has no scan events associated with the label.

Please note that before we issue a refund we will verify that the request is valid—for example, by ensuring that the label has not been used.

Input: Your email address and the link returned from a prior call where rel=”refund”
Output: A service ticket number
Error Example: A refund request has already been submitted for this shipment. Refunds take a few days to be processed.
Typical Prior Call: Create Non-Contract Shipment, Get Non-Contract Shipments or Get Non-Contract Shipment
Typical Next Call: None
Version history: Release notes
Request Non-Contract Shipment Refund – Summary of Service

Request Non-Contract Shipment Refund – Summary of Service

Request Details

Request – Structure for Request Shipment Refund

Endpoint

Invoke the link returned from a prior call to Create Non-Contract Shipment, Get Non-Contract Shipment or Get Non-Contract Shipments where rel=”refund”.

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-refund-request xmlns=http://www.canadapost.ca/ws/ncshipment-v4”>
xxx
</non-contract-shipment-refund-request>

Request – Elements

The table below describes the XML input elements for Request Non-Contract Shipment Refund. For the hierarchical structure of the inputs, see the XML diagram

Request Non-Contract Shipment Refund – Request Elements
Element Name Type Required / Optional Description

non-contract-shipment-refund-request

Complex

Required

The overall XML structure for the request input information.

email

Simple

Required

(Character string - up to 60 characters)
Must be a valid email address, i.e. pattern of (['_A-Za-z0-9\-\+])(\.['_A-Za-z0-9\-\+])@([A-Za-z0-9-])(\.[A-Za-z0-9-])(\.[A-Za-z]{2,})

Request – XML Diagram

Request Non-Contract Shipment Refund – Structure of XML Request
Request Non-Contract Shipment Refund – Structure of XML Request

Response Details

Response – Elements

The table below describes the XML fields in the response. For the hierarchy of the response, see the XML diagram

Request Non-Contract Shipment Refund - Response Elements
Element Name Type Description

non-contract-shipment-refund-request-info

Complex

This is the top level of the XML structure.

service-ticket-date

Simple

Date when the refund request was submitted.

service-ticket-id

Simple

The service ticket ID number for your refund request. Please use this number in any communications with Canada Post regarding this refund request.

Note: In the sandbox (development) environment, the same test value (0123456789) is always returned.

Response – XML Diagram

Request Non-Contract Shipment Refund – Structure of XML Response
Request Non-Contract Shipment Refund – Structure of XML Response

Response – Possible Error Responses

An http return code of 404 (Not found) will be returned if the shipment ID is incorrect. Other possible error responses include the following:

Code Description
7292 A refund request has already been submitted for this shipment. Refunds take a few days to be processed.
7296 The request could not be completed. You can try again later.

See also HTTP status codes and Error messages and mitigation strategies.

Examples

Sample REST XML Request – Request Non-Contract Shipment Refund

<non-contract-shipment-refund-request xmlns="http://www.canadapost.ca/ws/ncshipment-v4";>
<email>name@example.ca</email>
</non-contract-shipment-refund-request>

Sample REST XML Response – Request Non-Contract Shipment Refund

<non-contract-shipment-refund-request-info>
<service-ticket-date>2015-10-28</service-ticket-date>
<service-ticket-id>GT12345678RT</service-ticket-id>
</non-contract-shipment-refund-request-info>