GetRates Method
Returns rate information for a specified or all available services.
Syntax
canadapostrates.getRates([callback])
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for this method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
To get the courtesy rate quotes for Canada Post's services, call the GetRates method. If rates are needed for a specific service type, set the RequestedService property to the value you need the rates for (other than 0 : stUnspecified). The RequestedService property identifies the specific service for which you want to retrieve rate information.
If the rates are wanted for all available services, set RequestedService to 0 (stUnspecified). The server response will include a list of services, their associated rate, and guaranteed delivery time (if available).
The following properties are applicable:
- CanadaPostAccount (required)
- RequestedService (required)
- SenderAddress (required)
- RecipientAddress (required)
- Packages (required)
If the RecipientCountryCode is CA or US, the RecipientPostalCode is required.
The Service* properties are populated when this method returns.