CancelPackage Method
Cancels a single package shipment by deleting it from the shipping log.
Syntax
[VB.NET] Public Sub CancelPackage(ByVal TrackingNumber As String, ByVal TrackingIdType As Integer)
[C#] public void CancelPackage(string trackingNumber, int trackingIdType);
Remarks
To cancel a single package shipment, a delete shipment request should be sent to the FedEx Server. This can be done by calling CancelPackage method.
The TrackingNumber parameter that identifies the package to be canceled and deleted from the shipping log, is the TrackingNumber assigned to the package by FedEx server when either the GetPackageLabel or the GetShipmentLabels method was called.
The TrackingIdType parameter identifies the service that was used to ship the package. Possible values are:
Value | Id Type |
0 (default) | FedEx Express |
1 | FedEx Ground |
2 | USPS |
The following properties can be set prior to calling this method:
- Server (required)
- DeveloperKey (required)
- Password (required)
- AccountNumber (required)
- MeterNumber (required)
- ShipDate (optional)
- ShipTime; (optional)
These should be the values associated with the designated package to be canceled (i.e., the values used when this shipping request was made).
If you are unable to delete the package, you will receive an error condition. This error condition means that:
- For Ground shipments, a close has already been performed for that TrackingNumber.
- For Express shipments, the package has already been tendered to FedEx.
- You have entered an invalid AccountNumber or MeterNumber.
- The AccountNumber and MeterNumber, while valid, are not associated with one another or with the TrackingNumber.
- You entered an invalid TrackingNumber. This applies to Ground shipments only. Express accepts any number with the correct amount of digits.