PACKAGE_DELIVERY_CANCELLED

📘

Important

The Buy with Prime API is offered as a preview and might change as we receive feedback and iterate on the interfaces. We are sharing this early documentation to help you learn about the Buy with Prime API as we write and iterate on the content.

The PACKAGE_DELIVERY_CANCELLED event is published when one or more items were successfully cancelled from the specified order. Typically, this event is a result of a shopper cancelling some (or all) of the ordered items early enough that these items were never shipped. The cancellation reason is available in the order data, which you can get by calling the Buy with Prime API in response to this event.

For details on the schema and fields of an event, see Event Interface.

The following examples are ways that you might use this event:

  • To enable customers to see on various touchpoints (for example, merchant order history, Amazon order history, Buy with Prime order details) that their item was cancelled, so that they're not waiting for their product.
  • To enable customer service agents to see that an item was cancelled, so that they can give the customer updated information if the customer reaches out by phone or email.
  • To enable developers to update their order management system and all of the downstream systems. Examples of downstream systems are analytics and reporting on business performance, accounting for remitting taxes, customer service agents helping customers who reach out, and so on.
  • To enable eCommerce managers to audit cancellations, so that they can make decisions about product updates or changes that they might need to make because customers aren't liking a particular product.
  • To enable eCommerce managers to audit products that are unfulfilled, so that they can either trigger re-supply, or some other action to resolve in the future.

After a PACKAGE_DELIVERY_CANCELLED event is published, a REFUND_REQUESTED event is also published.

Required permission

To subscribe to this event, your API credentials must have at least Read Order permission. You choose permission scopes when you generate your API credentials. For details, see Authenticate to the Buy with Prime API.

Handling the event

When you receive this event, you typically query the order to fetch the delivery information for all line items in the order. Take the following steps:

  1. Parse the resources array of the event to get the order ID and delivery ID.
  2. Using the order ID that you found in the resources array in the previous step, make an API call to the order query. For examples of how to perform this query, see Query a Buy with Prime Order.
  3. In the response, navigate to the lineItems.packageInformation.details array and find the element with the ID that you found in the resources array of the event in step 1. There, you will find the details of delivery and a set of products delivered together to the customer. Several lines items can have the same delivery ID.
    Note: Depending on the moment that you call the Buy with Prime API with respect to delivery progress, the value of the state attribute in the delivery details is either IN_TRANSIT, CANCELLED, or DELIVERED. For more information, see PACKAGE_DELIVERY_IN_TRANSIT and PACKAGE_DELIVERED.
  4. Find the reason for item cancellation from the packageInformation.details.reason field. This field can be one of the following values:
    • CUSTOMER_REQUESTED: The customer requested cancellation.
    • UNFULFILLABLE: Amazon is unable to fulfill this item.
    • UNDELIVERABLE: Failure during delivery.

Related topics