Cancel a shipment
Learn how to use the Merchant Fulfillment API to cancel a shipment.
Learn how to use the Merchant Fulfillment API to cancel a shipment.
Prerequisites
To complete this tutorial, you need:
- Authorization from the selling partner for whom you are making calls. For more information, refer to Authorizing Selling Partner API applications.
- The Direct-to-Consumer Shipping (Restricted) role assigned to your developer profile.
- The Direct-to-Consumer Shipping (Restricted) role selected in the app registration page for your application.
Step 1. Call the cancelShipment operation
cancelShipment operationNote
This is a restricted operation and requires a Restricted Data Token (RDT) for authorization. Some operations require restrictions because they contain customer PII data. These operations require passing an additional security review. For more information on RDT, refer to the Tokens API guide.
Call the cancelShipment operation and specify the ShipmentId value of the shipment you want to cancel.
This returns the details of a shipment, which includes the shipment status. It might also return one or more unexpected errors occurred during the cancelShipment operation.
Step 2. (Optional) Check the status of the canceled shipment
Note
This is a restricted operation and requires a Restricted Data Token (RDT) for authorization. Some operations require restrictions because they contain customer PII data. These operations require passing an additional security review. For more information on RDT, refer to the Tokens API guide.
- Call the
getShipmentoperation and specify theShipmentIdvalue for the canceled shipment. - Get the cancellation status from the status element returned by the
getShipmentoperation.
Errors
The service returns the
LabelCancelWindowExpirederror if the allotted time period for canceling a label has expired. Refer to Error codes.
Updated 14 days ago
