PACKAGE_DELIVERY_CANCELLED

📘

Buy with Prime API is now available for early access

Sign up for early access to the Buy with Prime API using the 'Sign Up' button below. The API may change as Amazon receives feedback and iterates on it.

The PACKAGE_DELIVERY_CANCELLED event is published when one or more items were successfully canceled from the specified order. Typically, this event is a result of a shopper canceling 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.

This event was previously called DELIVERY_CANCELLED.

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

  • To enable shoppers to see on various touchpoints (for example, merchant order history, Amazon order history, Buy with Prime order details) that their item was canceled, so that they're not waiting for their product.
  • To enable customer service representatives to see that an item was canceled, so that they can give the shopper updated information if the shopper 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 representatives helping shoppers who reach out, and so on.
  • To enable e-commerce managers to audit cancellations, so that they can make decisions about product updates or changes that they might need to make because shoppers aren't liking a particular product.
  • To enable e-commerce 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.

Schema

Schema for webhook destinations
{
    "idempotencyKey":"example-idempotency-key",
    "eventDescriptor": "PACKAGE_DELIVERY_CANCELLED",
    "resources": [
        "businessProduct/business-product-id/order/order-id/delivery/delivery-id"
    ],
    "eventId":"example-event-id",
    "apiVersion": "2024-11-01",
    "subscriptionId": "example-subscription-id",
    "eventTime":"2025-01-20T12:34:56Z",
    "data": {
        "order": {
            "id": "example-order-id",
            "aliases": [
                {
                    "aliasId": "example-alias-id",
                    "aliasType": "example-alias-type"
                }
            ],
            "packageInformation": {
                "details": [
                    {
                            "id": "example-delivery-information-id",
                            "state": "CANCELLED",
                            "packageInformationDetailsFor": {
                            "orderLineItems": [
                                {
                                    "lineItem": {
                                        "id": "example-line-item-id"
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        }
    }
}

Schema for Amazon EventBridge destinations
{
    "version": "0",
    "id": "example-event-id",
    "detail-type": "PACKAGE_DELIVERY_CANCELLED",
    "source": "aws.partner/buywithprime/partner-event-source-name",
    "account": "example-aws-account-id",
    "time": "2025-01-20T12:34:56Z",
    "region": "us-east-1",
    "resources": [
        "businessProduct/business-product-id/order/order-id/delivery/delivery-id"
    ], 
    "detail": {
        "idempotencyKey":"example-idempotency-key",
        "eventDescriptor": "PACKAGE_DELIVERY_CANCELLED",
        "resources": [
            "businessProduct/business-product-id/order/order-id/delivery/delivery-id"
        ],
        "eventId":"example-event-id",
        "apiVersion": "2024-11-01",
        "subscriptionId": "example-subscription-id",
        "eventTime":"2025-01-20T12:34:56Z",
        "data": {
            "order": {
                "id": "example-order-id",
                "aliases": [
                    {
                        "aliasId": "example-alias-id",
                        "aliasType": "example-alias-type"
                    }
                ],
                "packageInformation": {
                    "details": [
                        {
                                "id": "example-delivery-information-id",
                                "state": "CANCELLED",
                                "packageInformationDetailsFor": {
                                "orderLineItems": [
                                    {
                                        "lineItem": {
                                            "id": "example-line-item-id"
                                        }
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        }
    }
}

Fields

KeyData typeDescription
versionStringAmazon EventBridge event version.
idStringAmazon EventBridge-generated UUID for an event.
detail-typeStringType schema for the detail of the event, which in this case is PACKAGE_DELIVERY_CANCELLED.
sourceStringName of the partner event source in Amazon EventBridge. For details, see Subscribe to Events.
accountStringAWS account ID that hosts the partner event source.
timeStringISO 8601 timestamp that indicates when the event was published.
regionStringAWS region from which the event is published.
resourcesArray of stringsArray of identifiers for the resources that triggered the event, in key-value pair format. Each resource identifier is a string that starts with businessProduct/{businessProductId}/, followed by resource types (keys) and resource IDs (values) separated by slashes. For details about how to interpret resources, see Subscribe to Events.
detailObjectJSON object that contains details about the event. For details, see detail fields.

Detail fields

KeyData typeDescription
idempotencyKeyStringUnique identifier to detect duplicate events.
eventDescriptorStringEvent type that determines the default query.
resourcesArray of stringsArray of identifiers for the resources that triggered the event, in key-value pair format. Each resource identifier is a string that starts with businessProduct/{businessProductId}/, followed by resource types (keys) and resource IDs (values) separated by slashes. This field is the same value as resources at the top level.
eventIdStringUnique identifier for this event. This field is the same value as id at the top level.
apiVersionStringBuy with Prime API version associated with this event.
subscriptionIdStringUnique identifier for an event subscription.
eventTimeStringISO 8601 timestamp that indicates when the event was published. This field is the same value as time at the top level.
dataObjectJSON object that can contain API response data. The PACKAGE_DELIVERY_CANCELLED event's data payload contains the package's associated order object.

Handling the event

When you receive this event, you typically parse the included order information found in the data object to fetch delivery information for all line items in the order. Take the following steps:

  1. Parse the resources array of the event to get the delivery ID.
  2. In the data object, navigate to the packageInformation.details array and find the element with the delivery ID that you found in the resources array of the event. The element with the delivery ID contains delivery details and a set of products delivered together to the shopper. Several line items can have the same delivery ID.
  3. Find the reason for item cancellation from the packageInformation.details.reason field. This field can be one of the following values:
    • CUSTOMER_REQUESTED: The shopper requested cancellation.
    • ORDER_HOLD_TIME_EXPIRED: Cancellation initiated after order exceeded the maximum allowable hold period.
    • UNFULFILLABLE: Amazon is unable to fulfill this item.
    • UNDELIVERABLE: Failure during delivery.

If you require information not found in the data object, query the order using the order ID found in the resources array.

Related topics