E-commerce Platforms

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

Get Merchant Registration Info – REST

Summary

Name: Get Merchant Registration Info
Reason to Call: Called by the e-commerce platform after the merchant has completed the Canada Post sign-up process. This call returns merchant data such as customer number and merchant username and password. This information is necessary for the platform to perform web service shipping transactions for the merchant.
Input: registration token identification number (token-id)
Output: merchant customer number, the merchant API key (username and password) and the merchant contract (if it exists).
Error Examples: Invalid token-id
Typical Prior Call: Get Merchant Registration Token
Version history: Release notes

Request Details

Request – Structure for Get Merchant Registration Info

Endpoint

GET https://XX/ot/token/{token-id}

Replace... With...

XX (Development)

ct.soa-gw.canadapost.ca

XX (Production)

soa-gw.canadapost.ca

{token-id}

the registration token identification number

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 – Query Parameters

The registration token-id is the only parameter required for this service.

Get Merchant Registration Info – Request Query Parameters
Query Parameter Name Type of
Parameter
Description

{token-id}

Directly embedded
in URI

{40-digit numeric}

Embedded within URI to call the service.

This is the Canada Post assigned unique token identification number for the merchant.

The platform must have retrieved this token-id number using the Get Merchant Registration Token web service and must also have launched the merchant registration process using this token-id.

Response Details

Response – Elements

Get Merchant Registration Info – Response Elements
Element Name Type Description

merchant-info

Complex

The top level XML element for the response structure.

Represents the information for the merchant.

Note: In the sandbox environment, the information for the generic test customer is returned. To test Developer Program services using a specific merchant, use their production environment merchant API key in the sandbox environment. It is valid in both environments.

customer-number

Simple

The customer number of the merchant.

Customer numbers are 10 digits. If the number provided is less than 10 digits, the system will add leading zeros.

contract-number

Simple

The contract number of the merchant if the merchant has a single contract. If the merchant does not have a contract, or has multiple contracts, no contract number will be returned.

Contract numbers are 10 digits. If the number provided is less than 10 digits, the system will add leading zeros.

merchant-username

Simple

The username portion of the merchant API key

merchant-password

Simple

The password portion of the merchant API key

has-default-credit-card

Simple

{true,false}

Indicates whether the merchant has a default credit card on file with Canada Post that can be used for shipping transactions.

If the value is true, the merchant can perform shipping transactions without a contract and charge shipments to the credit card.

If this value and has-supplier-account are false, the merchant cannot perform shipping transactions without a contract.

has-default-supplier-account

Simple

{true,false}

Indicates whether the merchant has a default Supplier Account on file with Canada Post that can be used for shipping transactions.

If the value is true, the merchant can perform shipping transactions using that method of payment.

If this value and has-default-credit-card are false, the merchant cannot perform shipping transactions without a contract.

Note: Supplier Account as a method of payment is only available to suppliers.

Response – XML Diagram

Get Merchant Registration Info – Structure of the XML Response

Get Merchant Registration Info – 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.

Examples

Sample REST XML Request – Get Merchant Registration Info

GET https://XX/ot/token/123435566

Sample REST XML Response – Get Merchant Registration Info

<merchant-info>
<customer-number>1234567890</customer-number>
<contract-number>1234567890-</contract-number>
<merchant-username>1234567890123456</merchant-username>
<merchant-password>12343567890123456789012</merchant-password>
<has-default-credit-card>false</has-default-credit-card>
<has-default-supplier-account>true</has-default-supplier-account>
<merchant-info>