deliveryPreview

Version 2024-04-01

Overview

Returns the delivery offers for the delivery of items.

ℹ️

Required scope(s)

View Delivery Preview

Response

Return type DeliveryPreview

Arguments

ArgumentDescription
input (DeliveryPreviewInput required)

Specifies the input fields required for generation of Delivery Preview.

Examples


Get Estimated Delivery Preview With Shipping Location And No Shopper Identity

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
            terms: {
                location: {
                    shippingAddress: {
                        postalCode: "98103"
                    }
                }
            }
        }
    ) {
        id
        deliveryGroups {
            id
            products {
                productIdentifier {
                __typename
                value
                ... on AmazonSkuProductIdentifier {
                        marketplaceId
                    }
                }
                amount {
                    unit
                    value
                }
            }
            deliveryOffers {
                id
                price {
                    totalPrice {
                        currencyCode
                        amount
                    }
                    rollupPrices {
                        type
                        value {
                            currencyCode
                            amount
                        }
                    }
                }
                date {
                    earliest
                    latest
                }
                policy {
                    messaging {
                        messageText
                        locale
                        badge
                    }
                    productMessaging {
                        products {
                            productIdentifier {
                                __typename
                                value
                                ... on AmazonSkuProductIdentifier {
                                    marketplaceId
                                }
                            }
                            amount {
                                unit
                                value
                            }
                        }
                        message {
                            messageText
                            locale
                            badge
                        }
                    }
                }
                expiresAt
            }
        }
    }
}

Response

{
  "data": {
    "deliveryPreview": {
      "id": "d973a860-0436-4659-aae8-e185b6250516",
      "deliveryGroups": [
        {
          "id": "5e00386f-11d4-4696-927d-b0b031a9396f",
          "products": [
            {
              "productIdentifier": {
                "__typename": "SkuProductIdentifier",
                "value": "prime_item_a"
              },
              "amount": {
                "unit": null,
                "value": 1
              }
            }
          ],
          "deliveryOffers": [
            {
              "id": "79180bf2-15ef-420c-9711-5892f82d7614",
              "price": {
                "totalPrice": {
                  "currencyCode": "USD",
                  "amount": 0
                },
                "rollupPrices": [
                ]
              },
              "date": {
                "earliest": "1970-01-20T14:14:06Z",
                "latest": "1970-01-20T14:14:06Z"
              },
              "policy": {
                "messaging": {
                  "messageText": "Get it on Wed, Aug 23",
                  "locale": "en-US",
                  "badge": "PRIME"
                },
                "productMessaging": []
              },
              "expiresAt": null
            }
          ]
        }
      ]
    }
  }
}

Get Estimated Delivery Preview With No Shopper Information

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
        }
    ) {
        id
        deliveryGroups {
            id
            products {
                productIdentifier {
                __typename
                value
                ... on AmazonSkuProductIdentifier {
                        marketplaceId
                    }
                }
                amount {
                    unit
                    value
                }
            }
            deliveryOffers {
                id
                price {
                    totalPrice {
                        currencyCode
                        amount
                    }
                    rollupPrices {
                        type
                        value {
                            currencyCode
                            amount
                        }
                    }
                }
                date {
                    earliest
                    latest
                }
                policy {
                    messaging {
                        messageText
                        locale
                        badge
                    }
                    productMessaging {
                        products {
                            productIdentifier {
                                __typename
                                value
                                ... on AmazonSkuProductIdentifier {
                                    marketplaceId
                                }
                            }
                            amount {
                                unit
                                value
                            }
                        }
                        message {
                            messageText
                            locale
                            badge
                        }
                    }
                }
                expiresAt
            }
        }
    }
}

Response

{
  "data": {
    "deliveryPreview": {
      "id": "d973a860-0436-4659-aae8-e185b6250516",
      "deliveryGroups": [
        {
          "id": "5e00386f-11d4-4696-927d-b0b031a9396f",
          "products": [
            {
              "productIdentifier": {
                "__typename": "SkuProductIdentifier",
                "value": "prime_item_a"
              },
              "amount": {
                "unit": null,
                "value": 1
              }
            }
          ],
          "deliveryOffers": [
            {
              "id": "79180bf2-15ef-420c-9711-5892f82d7614",
              "price": {
                "totalPrice": {
                  "currencyCode": "USD",
                  "amount": 0
                },
                "rollupPrices": [
                ]
              },
              "date": {
                "earliest": "2023-08-23T14:14:06Z",
                "latest": "2023-08-27T14:14:06Z"
              },
              "policy": {
                "messaging": {
                  "messageText": "Get it as soon as Wed, Aug 23",
                  "locale": "en-US",
                  "badge": "PRIME"
                },
                "productMessaging": []
              },
              "expiresAt": null
            }
          ]
        }
      ]
    }
  }
}

Get Estimated Delivery Preview With Fallback Message When No Estimate Provided

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a_with_no_delivery_estimate"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
            terms: {
                location: {
                    ipAddress: "192.184.1.100"
                }
            }
        }
    ) {
        id
        deliveryGroups {
            id
            products {
                productIdentifier {
                __typename
                value
                ... on AmazonSkuProductIdentifier {
                        marketplaceId
                    }
                }
                amount {
                    unit
                    value
                }
            }
            deliveryOffers {
                id
                price {
                    totalPrice {
                        currencyCode
                        amount
                    }
                    rollupPrices {
                        type
                        value {
                            currencyCode
                            amount
                        }
                    }
                }
                date {
                    earliest
                    latest
                }
                policy {
                    messaging {
                        messageText
                        locale
                        badge
                    }
                    productMessaging {
                        products {
                            productIdentifier {
                                __typename
                                value
                                ... on AmazonSkuProductIdentifier {
                                    marketplaceId
                                }
                            }
                            amount {
                                unit
                                value
                            }
                        }
                        message {
                            messageText
                            locale
                            badge
                        }
                    }
                }
                expiresAt
            }
        }
    }
}

Response

{
  "data": {
    "deliveryPreview": {
      "id": "d973a860-0436-4659-aae8-e185b6250516",
      "deliveryGroups": [
        {
          "id": "5e00386f-11d4-4696-927d-b0b031a9396f",
          "products": [
            {
              "productIdentifier": {
                "__typename": "SkuProductIdentifier",
                "value": "prime_item_a"
              },
              "amount": {
                "unit": null,
                "value": 1
              }
            }
          ],
          "deliveryOffers": [
            {
              "id": "79180bf2-15ef-420c-9711-5892f82d7614",
              "price": {
                "totalPrice": {
                  "currencyCode": "USD",
                  "amount": 0
                },
                "rollupPrices": [
                ]
              },
              "date": {
                "earliest": null,
                "latest": null
              },
              "policy": {
                "messaging": {
                  "messageText": "Fast, FREE Delivery.",
                  "locale": "en-US",
                  "badge": null
                },
                "productMessaging": []
              },
              "expiresAt": null
            }
          ]
        }
      ]
    }
  }
}

Get Estimated Delivery Preview With Authenticated Shopper

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
            terms: {
                shopperIdentity: {
                    lwaAccessToken: {
                        value: "prime_shopper_token_id"
                    }
                }
            }
        }
    ) {
        id
        deliveryGroups {
            id
            products {
                productIdentifier {
                __typename
                value
                ... on AmazonSkuProductIdentifier {
                        marketplaceId
                    }
                }
                amount {
                    unit
                    value
                }
            }
            deliveryOffers {
                id
                price {
                    totalPrice {
                        currencyCode
                        amount
                    }
                    rollupPrices {
                        type
                        value {
                            currencyCode
                            amount
                        }
                    }
                }
                date {
                    earliest
                    latest
                }
                policy {
                    messaging {
                        messageText
                        locale
                        badge
                    }
                    productMessaging {
                        products {
                            productIdentifier {
                                __typename
                                value
                                ... on AmazonSkuProductIdentifier {
                                    marketplaceId
                                }
                            }
                            amount {
                                unit
                                value
                            }
                        }
                        message {
                            messageText
                            locale
                            badge
                        }
                    }
                }
                expiresAt
            }
        }
    }
}

Response

{
  "data": {
    "deliveryPreview": {
      "id": "d973a860-0436-4659-aae8-e185b6250516",
      "deliveryGroups": [
        {
          "id": "5e00386f-11d4-4696-927d-b0b031a9396f",
          "products": [
            {
              "productIdentifier": {
                "__typename": "SkuProductIdentifier",
                "value": "prime_item_a"
              },
              "amount": {
                "unit": null,
                "value": 1
              }
            }
          ],
          "deliveryOffers": [
            {
              "id": "79180bf2-15ef-420c-9711-5892f82d7614",
              "price": {
                "totalPrice": {
                  "currencyCode": "USD",
                  "amount": 0
                },
                "rollupPrices": [
                ]
              },
              "date": {
                "earliest": "2023-10-20T14:14:06Z",
                "latest": "2023-10-23T14:14:06Z"
              },
              "policy": {
                "messaging": {
                  "messageText": "Get it on Wed, Oct 23",
                  "locale": "en-US",
                  "badge": "PRIME"
                },
                "productMessaging": []
              },
              "expiresAt": null
            }
          ]
        }
      ]
    }
  }
}

Get Estimated Delivery Preview For Ip Based Location

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
            terms: {
                location: {
                    ipAddress: "192.184.1.100"
                }
            }
        }
    ) {
        id
        deliveryGroups {
            id
            products {
                productIdentifier {
                __typename
                value
                ... on AmazonSkuProductIdentifier {
                        marketplaceId
                    }
                }
                amount {
                    unit
                    value
                }
            }
            deliveryOffers {
                id
                price {
                    totalPrice {
                        currencyCode
                        amount
                    }
                    rollupPrices {
                        type
                        value {
                            currencyCode
                            amount
                        }
                    }
                }
                date {
                    earliest
                    latest
                }
                policy {
                    messaging {
                        messageText
                        locale
                        badge
                    }
                    productMessaging {
                        products {
                            productIdentifier {
                                __typename
                                value
                                ... on AmazonSkuProductIdentifier {
                                    marketplaceId
                                }
                            }
                            amount {
                                unit
                                value
                            }
                        }
                        message {
                            messageText
                            locale
                            badge
                        }
                    }
                }
                expiresAt
            }
        }
    }
}

Response

{
  "data": {
    "deliveryPreview": {
      "id": "d973a860-0436-4659-aae8-e185b6250516",
      "deliveryGroups": [
        {
          "id": "5e00386f-11d4-4696-927d-b0b031a9396f",
          "products": [
            {
              "productIdentifier": {
                "__typename": "SkuProductIdentifier",
                "value": "prime_item_a"
              },
              "amount": {
                "unit": null,
                "value": 1
              }
            }
          ],
          "deliveryOffers": [
            {
              "id": "79180bf2-15ef-420c-9711-5892f82d7614",
              "price": {
                "totalPrice": {
                  "currencyCode": "USD",
                  "amount": 0
                },
                "rollupPrices": [
                ]
              },
              "date": {
                "earliest": "1970-01-20T14:14:06Z",
                "latest": "1970-01-20T14:14:06Z"
              },
              "policy": {
                "messaging": {
                  "messageText": "Get it on Wed, Aug 23",
                  "locale": "en-US",
                  "badge": "PRIME"
                },
                "productMessaging": []
              },
              "expiresAt": null
            }
          ]
        }
      ]
    }
  }
}

Get Delivery Preview

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a"
                    }
                    amount: {
                        value: 1
                    }
                },
                {
                    productIdentifier: {
                        sku: "prime_item_b"
                    }
                    amount: {
                        value: 1
                    }
                },
                {
                    productIdentifier: {
                        sku: "prime_item_c"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
            terms: {
                location: {
                    shippingAddress: {
                        name: "Shopper Name",
                        streetAddress: "1000 WINTHROP AVE N",
                        locality: "SEATTLE",
                        region: "WA",
                        postalCode: "98103",
                        countryCode: "US"
                    }
                },
                shopperIdentity: {
                    lwaAccessToken: {
                        value: "shopper_token_id"
                    }
                }
            }
        }
    ) {
        id
        deliveryGroups {
            id
            products {
                productIdentifier {
                __typename
                value
                ... on AmazonSkuProductIdentifier {
                        marketplaceId
                    }
                }
                amount {
                    unit
                    value
                }
            }
            deliveryOffers {
                id
                price {
                    totalPrice {
                        currencyCode
                        amount
                    }
                    rollupPrices {
                        type
                        value {
                            currencyCode
                            amount
                        }
                    }
                }
                date {
                    earliest
                    latest
                }
                policy {
                    messaging {
                        messageText
                        locale
                        badge
                    }
                    productMessaging {
                        products {
                            productIdentifier {
                                __typename
                                value
                                ... on AmazonSkuProductIdentifier {
                                    marketplaceId
                                }
                            }
                            amount {
                                unit
                                value
                            }
                        }
                        message {
                            messageText
                            locale
                            badge
                        }
                    }
                }
                expiresAt
            }
        }
    }
}

Response

{
  "data": {
    "deliveryPreview": {
      "id": "SIP-8035086-1118843",
      "deliveryGroups": [
        {
          "id": "9c1692a0-04a1-45d4-9396-5d07121bd932",
          "products": [
            {
              "productIdentifier": {
                "__typename": "SkuProductIdentifier",
                "value": "prime_item_a"
              },
              "amount": {
                "unit": null,
                "value": 1
              }
            },
            {
              "productIdentifier": {
                "__typename": "SkuProductIdentifier",
                "value": "prime_item_b"
              },
              "amount": {
                "unit": null,
                "value": 1
              }
            }
          ],
          "deliveryOffers": [
            {
              "id": "83dk2k3s-37sa-98r-9567-249dn3i5n44w",
              "price": {
                "totalPrice": {
                  "currencyCode": "USD",
                  "amount": 0
                },
                "rollupPrices": [
                ]
              },
              "date": {
                "earliest": "2023-08-24T03:00:00Z",
                "latest": "2023-08-28T03:00:00Z"
              },
              "policy": {
                "messaging": {
                  "messageText": "Thu, Aug 24 and Mon, Aug 28",
                  "locale": "en-US",
                  "badge": "PRIME"
                },
                "productMessaging": [
                  {
                    "products": [
                      {
                        "productIdentifier": {
                          "__typename": "SkuProductIdentifier",
                          "value": "prime_item_a"
                        },
                        "amount": {
                          "unit": null,
                          "value": 1
                        }
                      }
                    ],
                    "message": {
                      "messageText": "Thu, Aug 24",
                      "locale": "en-US",
                      "badge": "PRIME"
                    }
                  },
                  {
                    "products": [
                      {
                        "productIdentifier": {
                          "__typename": "SkuProductIdentifier",
                          "value": "prime_item_b"
                        },
                        "amount": {
                          "unit": null,
                          "value": 1
                        }
                      }
                    ],
                    "message": {
                      "messageText": "Mon, Aug 28",
                      "locale": "en-US",
                      "badge": "PRIME"
                    }
                  }
                ]
              },
              "expiresAt": "2023-08-21T21:27:35.016842Z"
            }
          ]
        },
        {
          "id": "8d3n2s-7dh3-0h3e-5892-37jnd73nek3ne",
          "products": [
            {
              "productIdentifier": {
                "__typename": "SkuProductIdentifier",
                "value": "prime_item_c"
              },
              "amount": {
                "unit": null,
                "value": 1
              }
            }
          ],
          "deliveryOffers": [
            {
              "id": "276n3hgd-3dwd-2452-59nr-3b3hbe3e",
              "price": {
                "totalPrice": {
                  "currencyCode": "USD",
                  "amount": 0
                },
                "rollupPrices": [
                ]
              },
              "date": {
                "earliest": "2023-08-24T03:00:00Z",
                "latest": "2023-08-24T03:00:00Z"
              },
              "policy": {
                "messaging": {
                  "messageText": "Thu, Aug 24",
                  "locale": "en-US",
                  "badge": "PRIME"
                },
                "productMessaging": [
                  {
                    "products": [
                      {
                        "productIdentifier": {
                          "__typename": "SkuProductIdentifier",
                          "value": "prime_item_c"
                        },
                        "amount": {
                          "unit": null,
                          "value": 1
                        }
                      }
                    ],
                    "message": {
                      "messageText": "Thu, Aug 24",
                      "locale": "en-US",
                      "badge": "PRIME"
                    }
                  }
                ]
              },
              "expiresAt": "2023-08-21T21:27:35.016842Z"
            }
          ]
        }
      ]
    }
  }
}

Get Delivery Preview With Invalid Shopper Token

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
            terms: {
                shopperIdentity: {
                    lwaAccessToken: {
                        value: "invalid_shopper_token_id"
                    }
                }
            }
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "The shopperIdentity idPToken in the request is invalid.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "InvalidIdpToken"
        }
      }
    }
  ],
  "data": null
}

Get Delivery Preview With Invalid Quantity Requested

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a"
                    }
                    amount: {
                        value: -100
                    }
                }
            ]
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "Selected quantity for item prime_item_a must be a positive integer",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "UnspecifiedError"
        }
      }
    }
  ],
  "data": null
}

Get Delivery Preview With Invalid Address

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "item_a"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
            terms: {
                location: {
                    shippingAddress: {
                        name: "Shopper Name",
                        streetAddress: "INVALID STREET ADDRESS",
                        locality: "INVALID LOCALITY",
                        region: "WA",
                        postalCode: "INVALID_POSTAL_CODE",
                        countryCode: "US"
                    }
                },
                shopperIdentity: {
                    lwaAccessToken: {
                        value: "shopper_token_id"
                    }
                }
            }
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "Invalid address for the shopper",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "InvalidAddress"
        }
      }
    }
  ],
  "data": {
    "deliveryPreview": {
      "id": "91b905a3-b1e4-488d-a466-323901306408",
      "deliveryGroups": []
    }
  }
}

Get Delivery Preview With Expired Shopper Token

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
            terms: {
                shopperIdentity: {
                    lwaAccessToken: {
                        value: "expired_shopper_token_id"
                    }
                }
            }
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "The shopperIdentity idPToken in the request is expired.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "ExpiredIdpToken"
        }
      }
    }
  ],
  "data": null
}

Get Delivery Preview For Non Prime Shopper

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
            terms: {
                shopperIdentity: {
                    lwaAccessToken: {
                        value: "non_prime_shopper_token_id"
                    }
                }
            }
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "Shopper is not Prime eligible",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "ShopperNotPrimeEnabled"
        }
      }
    }
  ],
  "data": {
    "deliveryPreview": {
      "id": "91b905a3-b1e4-488d-a466-323901306408",
      "deliveryGroups": []
    }
  }
}

Get Delivery Preview For Non Prime Item

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "non_prime_item"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "Item non_prime_item is not Prime enabled",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "ItemNotPrimeEnabled"
        }
      }
    }
  ],
  "data": {
    "deliveryPreview": {
      "id": "91b905a3-b1e4-488d-a466-323901306408",
      "deliveryGroups": []
    }
  }
}

Get Delivery Preview For Items Not Found In Catalog

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "invalid_item_id"
                    }
                    amount: {
                        value: 2
                    }
                },
            ]
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "Item invalid_item_id missing from the catalog",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ResourceNotFoundError"
        }
      }
    }
  ],
  "data": {
    "deliveryPreview": {
      "id": "91b905a3-b1e4-488d-a466-323901306408",
      "deliveryGroups": []
    }
  }
}

Get Delivery Preview For Item With Selected Quantity Unavailable

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "item_with_low_inventory"
                    }
                    amount: {
                        value: 10000
                    }
                }
            ]
            terms: {
                location: {
                    shippingAddress: {
                        name: "Shopper Name",
                        streetAddress: "1000 WINTHROP AVE N",
                        locality: "SEATTLE",
                        region: "WA",
                        postalCode: "98103",
                        countryCode: "US"
                    }
                },
                shopperIdentity: {
                    lwaAccessToken: {
                        value: "shopper_token_id"
                    }
                }
            }
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "Selected quantity is not available for the item item_with_low_inventory",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "ItemAmountUnavailable"
        }
      }
    }
  ],
  "data": {
    "deliveryPreview": {
      "id": "91b905a3-b1e4-488d-a466-323901306408",
      "deliveryGroups": []
    }
  }
}

Get Delivery Preview For Item Providing No Identifier

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "Input request is not valid, the following issues were encountered: [Expect at least one item identifier provided.]",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "UnspecifiedError",
          "details": {}
        }
      }
    }
  ],
  "data": null
}

Get Delivery Preview For Item Providing Multiple Identifiers

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "prime_item_a",
                        productId: "prime_item_a"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "Input request is not valid, the following issues were encountered: [One and only one item identifier should be provided per item.]",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "UnspecifiedError",
          "details": {}
        }
      }
    }
  ],
  "data": null
}

Get Delivery Preview For Item Out Of Stock

Request

query deliveryPreview {
    deliveryPreview(
        input: {
            products: [
                {
                    productIdentifier: {
                        sku: "item_with_zero_inventory"
                    }
                    amount: {
                        value: 1
                    }
                }
            ]
            terms: {
                location: {
                    shippingAddress: {
                        name: "Shopper Name",
                        streetAddress: "1000 WINTHROP AVE N",
                        locality: "SEATTLE",
                        region: "WA",
                        postalCode: "98103",
                        countryCode: "US"
                    }
                },
                shopperIdentity: {
                    lwaAccessToken: {
                        value: "shopper_token_id"
                    }
                }
            }
        }
    ) {
        id
    }
}

Response

{
  "errors": [
    {
      "message": "Item item_with_zero_inventory is out of stock",
      "locations": [
        {
          "line": 2,
          "column": 2
        }
      ],
      "path": [
        "deliveryPreview"
      ],
      "extensions": {
        "classification": {
          "type": "ValidationError",
          "code": "ItemOutOfStock"
        }
      }
    }
  ],
  "data": {
    "deliveryPreview": {
      "id": "91b905a3-b1e4-488d-a466-323901306408",
      "deliveryGroups": []
    }
  }
}