E-commerce Platforms

Code Samples for E-commerce Platforms: Java (.zip) | PHP (.zip) | C# (.zip)

Get Merchant Registration Token – REST

Summary

Name: Get Merchant Registration Token
Reason to Call:

To get a unique registration token that is used to launch a merchant into the Canada Post sign-up process.

Note: You do not need to re-register a merchant in the Sandbox (development) environment; their production API key is valid in both environments. To test as a generic merchant, use customer number 2004381 with contract number 42708517.

Input: No input is required, but this web service can only be called by e-commerce platforms that have been approved by Canada Post.
Output: A token-id that is used to register a merchant with Canada Post.
Error Examples: Platform not authorized to call this web service.
Version history: Release notes

Request Details

Request – Structure for Get Merchant Registration Token

Endpoint

https://XX/ot/token

Replace... With...

XX (Development)

ct.soa-gw.canadapost.ca

XX (Production)

soa-gw.canadapost.ca

HTTP Headers

HTTP Header Variable

Value

Accept

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

Content-Type

application/vnd.cpc.registration-v2+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

This service does not require any input XML elements.

Response Details

Response – Elements

Get Merchant Registration Token – Response Elements
Element Name Type Description

token

Complex

The top level XML element for the response structure.

token-id

Simple

The unique token identification number used to launch a merchant into the Canada Post sign-up process.

The same stubbed value (1111111111111111) is always returned in the sandbox (development) environment.

Response – XML Diagram

Get Merchant Registration Token – Structure of the XML Response

Get Merchant Registration Token – Structure of the XML Response

Response – Possible Error Responses

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

Possible error messages for this service include the following:

Code Name Description

AA007

Platform not active

You will receive this error if you have tried to use Get Merchant Registration Token while your application to become an approved e-commerce platform with Canada Post is still pending. You cannot use this service until Canada Post has approved your application.

AA008

Unauthorized Platform

You will receive this error if you are attempting to use Get Merchant Registration Token service but have not applied to become an e-commerce platform with Canada Post. To apply, sign in to the Developer Program home page and select Become a Platform.

Examples

Sample REST MXL Request – Get Merchant Registration Token

https://XX/ot/token

Sample REST XML Response – Get Merchant Registration Token

<token>
<token-id>34536456345353534535</token-id>
</token>