updateOrderPackageInformation

Version 2024-11-01

📘

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.

Overview

Update a BwP Order's package information. (Only enabled in Sandbox mode)

Response

Return type UpdateOrderPackageInformationResponse

Arguments

ArgumentDescription
input (UpdateOrderPackageInformationInput required)

Specifies the input fields to update the order package details.

orderIdentifier (OrderIdentifierInput required)

Identifier of the order to update

Examples


Update Partial Quantities Of Same Line Item Cancelled Unfulfillable Others As In Transit

Request

mutation updateOrderPackageInformation {
    updateOrderPackageInformation(
        orderIdentifier: {
            orderId: "123-4567-8910"
        }
        input: {
            packageInformation: {
                details: [
                    {
                        id: "example-package-information-details-id"
                        packageState: {
                            packageInformationState: {
                                state: CANCELLED
                                reason: UNFULFILLABLE
                                packageInformationDetailsFor: {
                                    orderLineItemAmounts: [
                                        {
                                            lineItemId: {
                                                lineItemId: "example-line-item-id-1"
                                            }
                                            amount: {
                                                value: 1
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    {
                        id: "example-package-information-details-id"
                        packageState: {
                            packageInformationState: {
                                state: IN_TRANSIT
                                packageInformationDetailsFor: {
                                    orderLineItemAmounts: [
                                        {
                                            lineItemId: {
                                                lineItemId: "example-line-item-id-1"
                                            }
                                            amount: {
                                                value: 1
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }
                ]
            }
        }
    ) {
        order {
            id
        }
    }
}

Response

{
  "data": {
    "updateOrderPackageInformation": {
      "order": {
        "id": "123-4567-8910"
      }
    }
  }
}

Update Package Delivered By Updating Package Tracker As Delivered

Request

mutation updateOrderPackageInformation {
    updateOrderPackageInformation(
        orderIdentifier: {
            orderId: "123-4567-8910"
        }
        input: {
            packageInformation: {
                details: [
                    {
                        id: "example-package-information-details-id"
                        packageState: {
                            packageTrackerState: {
                                packageTrackerIdentifier: {
                                    trackingNumber: "example-package-tracker-tracking-number"
                                    carrierCode: "example-package-tracker-carrier-code"
                                }
                                latestMilestone: {
                                    status: {
                                        code: DELIVERED
                                    }
                                }
                            }
                        }
                    }
                ]
            }
        }
    ) {
        order {
            id
        }
    }
}

Response

{
  "data": {
    "updateOrderPackageInformation": {
      "order": {
        "id": "123-4567-8910"
      }
    }
  }
}

Update Package Delivered

Request

mutation updateOrderPackageInformation {
    updateOrderPackageInformation(
        orderIdentifier: {
            orderId: "123-4567-8910"
        }
        input: {
            packageInformation: {
                details: [
                    {
                        id: "example-package-information-details-id"
                        packageState: {
                            packageInformationState: {
                                state: DELIVERED
                            }
                        }
                    }
                ]
            }
        }
    ) {
        order {
            id
        }
    }
}

Response

{
  "data": {
    "updateOrderPackageInformation": {
      "order": {
        "id": "123-4567-8910"
      }
    }
  }
}

Update Package Cancelled Due To Undeliverable

Request

mutation updateOrderPackageInformation {
    updateOrderPackageInformation(
        orderIdentifier: {
            orderId: "123-4567-8910"
        }
        input: {
            packageInformation: {
                details: [
                    {
                        id: "example-package-information-details-id"
                        packageState: {
                            packageInformationState: {
                                state: CANCELLED
                                reason: UNDELIVERABLE
                            }
                        }
                    }
                ]
            }
        }
    ) {
        order {
            id
        }
    }
}

Response

{
  "data": {
    "updateOrderPackageInformation": {
      "order": {
        "id": "123-4567-8910"
      }
    }
  }
}

Update Multiple Packages Delivered

Request

mutation updateOrderPackageInformation {
    updateOrderPackageInformation(
        orderIdentifier: {
            orderId: "123-4567-8910"
        }
        input: {
            packageInformation: {
                details: [
                    {
                        id: "example-package-information-details-id-1"
                        packageState: {
                            packageInformationState: {
                                state: DELIVERED
                            }
                        }
                    },
                    {
                        id: "example-package-information-details-id-2"
                        packageState: {
                            packageInformationState: {
                                state: DELIVERED
                            }
                        }
                    }
                ]
            }
        }
    ) {
        order {
            id
        }
    }
}

Response

{
  "data": {
    "updateOrderPackageInformation": {
      "order": {
        "id": "123-4567-8910"
      }
    }
  }
}

Update In Transit Package Tracking Status Code To Out For Delivery

Request

mutation updateOrderPackageInformation {
    updateOrderPackageInformation(
        orderIdentifier: {
            orderId: "123-4567-8910"
        }
        input: {
            packageInformation: {
                details: [
                    {
                        id: "example-package-information-details-id"
                        packageState: {
                            packageTrackerState: {
                                packageTrackerIdentifier: {
                                    trackingNumber: "example-package-tracker-tracking-number"
                                    carrierCode: "example-package-tracker-carrier-code"
                                }
                                latestMilestone: {
                                    status: {
                                        code: OUT_FOR_DELIVERY
                                    }
                                }
                            }
                        }
                    }
                ]
            }
        }
    ) {
        order {
            id
        }
    }
}

Response

{
  "data": {
    "updateOrderPackageInformation": {
      "order": {
        "id": "123-4567-8910"
      }
    }
  }
}

Update All Line Items Cancelled Due To Customer Request

Request

mutation updateOrderPackageInformation {
    updateOrderPackageInformation(
        orderIdentifier: {
            orderId: "123-4567-8910"
        }
        input: {
            packageInformation: {
                details: [
                    {
                        id: "example-package-information-details-id"
                        packageState: {
                            packageInformationState: {
                                state: CANCELLED
                                reason: CUSTOMER_REQUESTED
                            }
                        }
                    }
                ]
            }
        }
    ) {
        order {
            id
        }
    }
}

Response

{
  "data": {
    "updateOrderPackageInformation": {
      "order": {
        "id": "123-4567-8910"
      }
    }
  }
}

Update All Items In Transit In Single Package

Request

mutation updateOrderPackageInformation {
    updateOrderPackageInformation(
        orderIdentifier: {
            orderId: "123-4567-8910"
        }
        input: {
            packageInformation: {
                details: [
                    {
                        id: "example-package-information-details-id"
                        packageState: {
                            packageInformationState: {
                                state: IN_TRANSIT
                            }
                        }
                    }
                ]
            }
        }
    ) {
        order {
            id
        }
    }
}

Response

{
  "data": {
    "updateOrderPackageInformation": {
      "order": {
        "id": "123-4567-8910"
      }
    }
  }
}

Update All Items In Transit In Multiple Packages

Request

mutation updateOrderPackageInformation {
    updateOrderPackageInformation(
        orderIdentifier: {
            orderId: "123-4567-8910"
        }
        input: {
            packageInformation: {
                details: [
                    {
                        id: "example-package-information-details-id"
                        packageState: {
                            packageInformationState: {
                                state: IN_TRANSIT
                                packageInformationDetailsFor: {
                                    orderLineItemAmounts: [
                                        {
                                            lineItemId: {
                                                lineItemId: "example-line-item-id-1"
                                            }
                                            amount: {
                                                value: 1
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    {
                        id: "example-package-information-details-id"
                        packageState: {
                            packageInformationState: {
                                state: IN_TRANSIT
                                packageInformationDetailsFor: {
                                    orderLineItemAmounts: [
                                        {
                                            lineItemId: {
                                                lineItemId: "example-line-item-id-2"
                                            }
                                            amount: {
                                                value: 1
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    }
                ]
            }
        }
    ) {
        order {
            id
        }
    }
}

Response

{
  "data": {
    "updateOrderPackageInformation": {
      "order": {
        "id": "123-4567-8910"
      }
    }
  }
}