Refund Method
Submit refund requests for an account.
Syntax
uspsmgr.refund(id, idType, [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, data){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'data' is the value returned by the method.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
This method provides a way to request a refund for a shipment. The identifier specified will typically be the Tracking Number (referred to as the PIC Number). The table below lists the possible values for the IdType parameter.
Value | Description |
0 (default) | The Tracking Number (PIC Number). For Stamps.com this is the StampsTxId. |
1 | The Package Customs Id |
2 | The Package Piece Id |
The Piece Id and Tracking Number are both acceptable types of identification and can be used interchangeably.
The Customs Id type is only applicable to PriorityMailInternational and ExpressMailInternational shipments.
When refunding a shipment through Endicia, USPSServer must be set to the URL of the ELS services, for instance:
https://elstestserver.endicia.com/ELS/ELSServices.cfcOther operations such as label generation use the EWS label services, however refunds use ELS by default and require a different endpoint. Alternatively, set UseEWSService to True to use EWS for refunds (recommended).