Contract Shipping

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

Get Customer Information – REST

Summary

Name:

Get Customer Information

Reason to Call:

To retrieve details on allowed payers, methods of payment and other information about a customer to determine the proper customer number for charging shipping costs.

Input:

The customer number for which customer information is desired.

Output:

Contract numbers, authorized payers, allowed methods of payment and links to other mailed-on-behalf-of customers previously mailed for (if any).

Error Examples:

Customer number not valid

Possible Next Calls: Get MOBO Customer Information, Create Shipment
Version history: Release notes

Overview of Get Customer Information

Customer Information - Summary of Service

Get Customer Information - Summary of Service

The Get Customer Information service provides information indicating whether a customer account can be used to charge shipment costs.

Request Details

Request – Structure for Get Customer Information

Endpoint

GET https://XX/rs/customer/{mailed by customer}

Replace... With...

XX (Development)

ct.soa-gw.canadapost.ca

XX (Production)

soa-gw.canadapost.ca

{mailed by customer}

your customer number

HTTP Headers

HTTP Header Variable

Value

Accept

application/vnd.cpc.customer+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 Customer Information service does not require any input XML data.

Response Details

Response – Elements

This is the response structure to a customer information request from a given mailed-by customer number.

Get Customer Information – REST – Detailed View of Response Elements
Field Name Type Field Information

customer

complex

The top level XML element structure.

customer-number

Simple

Mailed-by customer

(maximum 10 numeric characters)

contracts

Complex

Structure that contains the contracts that the customer owns or is authorized to use. Only contracts effective as of the date of the request are listed.

contract-id

Simple

Contract Number (also called Agreement Number).

(10 numeric characters)

authorized-payers

Complex

Structure that contains allowable paid-by customer numbers and methods of payment.

payer

Complex

Contained in authorized-payers.

payer-number

Simple

Customer number of a payer which could be used for the mailed-by customer (where the mailed-by and behalf-of numbers are the same)

(10 numeric characters)

methods-of-payment

Complex

Structure that contains the methods of payment that this payer can use.

method-of-payment

Simple

Can contain:

  • account

Note that if a payer has no method of payment, the payer can’t be used to ship at this moment.

Contained in methods-of-payment.

{10-character string}

links

Complex

Contained in customer.

Structure that contains links to the mailed-on-behalf-of and contract combinations that the mailed-by customer (the customer specified in the request) has used previously.

  • The mailed-by (calling customer number) is excluded from these links (i.e. no “self” link).
  • If a previously used customer is now closed or blocked, it will not be in the list.

 link

Simple

May occur 1 … N times.

The link structure contains a number of link elements, each allowing the user to separately retrieve the profile of a different behalf-of customer.

Contained in links

rel="behalf-of-customer" for these links.

See Provided Endpoints for more details.

Response – Possible Error Responses

See HTTP status codes for general error handling information.

get-customer-info (mailed-by) XML Diagram

Examples

Sample REST XML Request – Get Customer Information

GET https://XX/rs/customer/1234567
Accept:application/vnd.cpc.customer+xml
Authorization:s7HD7gwsennesc==
Accept-Language:fr-ca

Sample REST XML Response – Get Customer Information

<customer>
<customer-number>0001234567</customer-number>
<contracts>
<contract-id>0012345678</contract-id>
</contracts>
<authorized-payers>
<payer>
<payer-number>0001234567</payer-number>
<methods-of-payment>
<method-of-payment>account</method-of-payment>
</methods-of-payment>
</payer>
</authorized-payers>
<links>
<link rel="behalf-of-customer" href="https://XX/rs/customer/022222222/behalfof/33333333" media-type="application/vnd.cpc.customer+xml"></link>
<link rel="behalf-of-customer" href="https://XX/rs/customer/22222222/behalfof/33333333" media-type="application/vnd.cpc.customer+xml"></link>
</links>
</customer>