Query a Buy with Prime Order

📘

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.

This topic provides examples of how to use the Order interface to get information about a Buy with Prime order. In general, you might want to query Buy with Prime orders in the following situations:

  • Before updating a Buy with Prime order (for example, to indicate that a pending refund was successful).
  • Before updating the status of a Buy with Prime order in your order management system (for example, if you receive a Buy with Prime DELIVERY_CANCELLED event).
  • To show information, such as delivery tracking, on your site.

To learn how to call the Buy with Prime API, see Call the Buy with Prime API.

Sample data

The examples in this topic use the following sample data.

Order identifier
{
  "orderIdentifier": {
    "alias": {
      "aliasType": "EXTERNAL_ID",
      "aliasId": "example-alias-id"
    }
  }
}
Order aliases
{
  "data": {
    "order": {
      "aliases": [
        {
          "aliasId": "example-alias-id",
          "aliasType": "EXTERNAL_ID"
        }
      ]
    }
  }
}
Customer
{
  "data": {
    "order": {
      "id": "example-order-id",
      "customer": {
        "contact": {
          "id": "example-contact-id",
          "name": "John Doe",
          "email": "[[email protected]](mailto:[email protected])"
        }
      }
    }
  }
}
Tax summary
{
  "data": {
    "order": {
      "id": "example-order-id",
      "taxes": {
        "summary": {
          "collectableTaxAmount": {
            "amount": 10,
            "currencyCode": "USD"
          }
        }
      }
    }
  }
}
Discount summary
{
  "data": {
    "order": {
      "id": "example-order-id",
      "discounts": {
        "summary": {
          "amount": {
            "amount": 1,
            "currencyCode": "USD"
          },
          "displayString": "20% off on orders above $100"
        }
      }
    }
  }
}
Discount details
{
  "data": {
    "order": {
      "id": "example-order-id",
      "discounts": {
        "details": [
          {
            "amount": {
              "amount": 1,
              "currencyCode": "USD"
            },
            "displayString": "20% off on orders above $100",
            "aliases": [
              {
                "aliasType": "EXTERNAL_ID",
                "aliasId": "M001"
              }
            ],
            "couponCode": "BWP001"
          }
        ]
      }
    }
  }
}
Order total price
{
  "data": {
    "order": {
      "id": "example-order-id",
      "totalPrice": {
        "value": {
          "amount": 10,
          "currencyCode": "USD"
        }
      }
    }
  }
}
Payment summary
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          },
          "payments": {
            "summary": {
              "amount": {
                "amount": 10,
                "currencyCode": "USD"
              },
              "paymentMethodDisplayString": "Visa ending in 1234",
              "state": "CAPTURED"
            }
          }
        }
      ]
    }
  }
}
Payment details
{
  "data": {
    "order": {
      "id": "example-order-id",
      "payments": {
        "details": [
          {
            "id": "example-payment-transfer-id",
            "amount": {
              "amount": 10
            },
            "paymentMethod": {
              "displayString": "AmazonPay",
              "type": "AMAZON_PAY"
            },
            "state": "SUCCESS",
            "payer": {
              "id": "amzn1.account.ABCDE12345"
            },
            "aliases": [
              {
                "aliasType": "EXTERNAL_ID",
                "aliasId": "PAY_001-123-456"
              }
            ],
            "createdAt": "2022-02-03T18:17:19Z",
            "updatedAt": "2022-02-04T18:17:19Z"
          }
        ]
      }
    }
  }
}
Refund summary
{
  "data": {
    "order": {
      "id": "example-order-id",
      "refunds": {
        "summary": {
          "refundTotal": {
            "totalAmount": {
              "amount": 30,
              "currencyCode": "USD"
            }
          },
          "paymentSummary": {
            "amount": {
              "amount": 30,
              "currencyCode": "USD"
            },
            "paymentMethodDisplayString": "Visa ending in 1234",
            "state": "REFUNDED"
          }
        }
      }
    }
  }
}
Refund details
{
  "data": {
    "order": {
      "id": "example-order-id",
      "refunds": {
        "details": [
          {
            "id": "example-refund-id",
            "createdAt": "2022-02-03T18:17:19Z",
            "updatedAt": "2022-02-03T18:17:19Z",
            "aliases": {
              "aliasType": "EXTERNAL_ID",
              "aliasId": "example-refund-alias"
            },
            "refundTotal": {
              "totalAmount": {
                "amount": 30,
                "currencyCode": "USD"
              }
            },
            "state": "SUCCESS",
            "refundFor": {
              "orderLineItems": [
                {
                  "lineItem": {
                    "id": "example-line-item-id",
                    "amount": {
                      "value": 1
                    }
                  }
                }
              ]
            },
            "paymentDetails": [
              {
                "id": "example-payment-transfer-id",
                "amount": {
                  "amount": 10
                },
                "paymentMethod": {
                  "displayString": "AmazonPay",
                  "type": "AMAZON_PAY"
                },
                "state": "SUCCESS",
                "payer": {
                  "id": "amzn1.account.12345ABCDE"
                },
                "aliases": [],
                "createdAt": "2022-02-03T18:17:19Z",
                "updatedAt": "2022-02-04T18:17:19Z"
              }
            ]
          }
        ]
      }
    }
  }
}
Returns
{
  "data": {
    "order": {
      "id": "example-order-id",
      "returns": {
        "details": [
          {
            "id": "example-refund-id",
            "createdAt": "2022-02-03T18:17:19Z",
            "updatedAt": "2022-02-03T18:17:19Z",
            "state": "COMPLETED",
            "returnFor": {
              "orderLineItems": [
                {
                  "lineItem": {
                    "id": "example-line-item-id",
                    "amount": {
                      "value": 1
                    }
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}
Order metadata
{
  "data": {
    "order": {
      "id": "example-order-id",
      "metadata": {
        "executionState": "NOT_STARTED",
        "createdAt": "2024-01-18T18:41:30.610Z",
        "updatedAt": "2024-01-18T18:41:30.610Z"
      }
    }
  }
}
Order links
{
  "data": {
    "order": {
      "id": "example-order-id",
      "orderLinks": [
        {
          "destinationType": "BWP_STOREFRONT",
          "url": "https://order.buywithprime.amazon.com/1234ABCD/orders/example-order-id"
        }
      ]
    }
  }
}

Email

This section contains a query that you can use to get order details for a confirmation email.

Get order details for a confirmation email

The following example gets information such as line items, customer details, and the order total. You might want this information for an order confirmation email.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    customer {
      contact {
        id
        name
        email
      }
    }
    lineItems {
      id
      amount {
        unit
        value
      }
      product {
        productId {
          value
        }
        title
        productDetailPageUrl
        image {
          displayReadyUrl
          sourceUrl
          altText
        }
        price {
          currencyCode
          amount
        }
        variationSelections {
          dimension
          value
        }
      }
    }
    totalPrice {
      value {
        amount
        currencyCode
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "customer": {
        "contact": {
          "id": "example-contact-id",
          "name": "John Doe",
          "email": "[email protected]"
        }
      },
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 2
          },
          "product": {
            "productId": {
              "value": "product-id"
            },
            "productDetailPageUrl": "productDetail-url",
            "image": {
              "displayReadyUrl": "https://example-image.jpeg",
              "sourceUrl": "example-image-url",
              "altText": "a11y friendly alternative text"
            },
            "title": "example-title",
            "price": {
              "currencyCode": "USD",
              "amount": 8
            },
            "variationSelections": [
              {
                "dimension": "color",
                "value": "red"
              }
            ]
          }
        }
      ],
      "totalPrice": {
        "value": {
          "amount": 10,
          "currencyCode": "USD"
        }
      }
    }
  }
}

Order detail page

This section contains queries that you can use to show items on an order detail page.

Get order details for an order detail page

The following example gets customer details, line items, delivery, and other information that you might show on an order detail page.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    customer {
      contact {
        id
        name
        email
      }
    }
    lineItems {
      id
      amount {
        unit
        value
      }
      product {
        productId {
          value
        }
        title
        productDetailPageUrl
        image {
          displayReadyUrl
          sourceUrl
          altText
        }
        price {
          currencyCode
          amount
        }
        variationSelections {
          dimension
          value
        }
      },
      deliveryOffer {
        details {
          taxes {
            summary {
              collectableTaxAmount {
                amount
                currencyCode
              }
            }
          }
          discounts {
            details {
              amount {
                amount
                currencyCode
              }
              couponCode
              aliases {
                aliasType
              }
              displayString
            }
          }
        }
      }
      taxes {
        summary {
          collectableTaxAmount {
            amount
            currencyCode
          }
        }
      }
      discounts {
        summary {
          amount {
            amount
            currencyCode
          }
        }
      }
      deliveryInformation {
        summary {
          state
        }
      }
      payments {
        summary {
          amount {
            amount
          }
          paymentMethodDisplayString
          state
        }
      }
    }
    taxes {
      summary {
        collectableTaxAmount {
          amount
          currencyCode
        }
      }
    }
    discounts {
      details {
        amount {
          amount
          currencyCode
        }
        couponCode
        aliases {
          aliasType
        }
        displayString
      }
    }
    totalPrice {
      value {
        amount
        currencyCode
      }
    }
    payments {
      summary {
        amount {
          amount
        }
        paymentMethodDisplayString
        state
      }
    }
    refunds {
      details {
        id
        updatedAt
        state
        refundTotal {
          totalAmount {
            amount
          }
        }
        refundFor {
          orderLineItems {
            lineItem {
              id
            }
          }
        }
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "customer": {
        "contact": {
          "id": "example-contact-id",
          "name": "John Doe",
          "email": "[email protected]"
        }
      },
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          },
          "createdAt": "2024-01-18T18:41:30.569Z",
          "product": {
            "productId": {
              "value": "product-id"
            },
            "title": "example-title",
            "image": {
              "displayReadyUrl": "https://example-image.jpeg",
              "sourceUrl": "example-image-url",
              "altText": "a11y friendly alternative text"
            },
            "price": {
              "currencyCode": "USD",
              "amount": 10
            },
            "variationSelections": [
              {
                "dimension": "color",
                "value": "red"
              }
            ]
          },
          "deliveryOffer": {
            "deliveryOfferDetails": {
              "taxes": {
                "summary": {
                  "collectableTaxAmount": {
                    "amount": 2,
                    "currencyCode": "USD"
                  }
                }
              },
              "discounts": {
                "summary": {
                  "amount": {
                    "amount": 1,
                    "currencyCode": "USD"
                  },
                  "displayString": "20% off on orders above $100"
                }
              }
            }
          },
          "taxes": {
            "summary": {
              "collectableTaxAmount": {
                "amount": 2,
                "currencyCode": "USD"
              }
            }
          },
          "discounts": {
            "summary": {
              "amount": {
                "amount": 1,
                "currencyCode": "USD"
              },
              "displayString": "20% off on orders above $100"
            }
          },
          "deliveryInformation": {
            "summary": {
              "state": "PENDING"
            }
          },
          "payments": {
            "summary": {
              "amount": {
                "amount": 10,
                "currencyCode": "USD"
              },
              "paymentMethodDisplayString": "Visa ending in 1234",
              "state": "CAPTURED"
            }
          }
        }
      ],
      "taxes": {
        "summary": {
          "collectableTaxAmount": {
            "amount": 2,
            "currencyCode": "USD"
          }
        }
      },
      "discounts": {
        "summary": {
          "amount": {
            "amount": 1,
            "currencyCode": "USD"
          },
          "displayString": "20% off on orders above $100"
        }
      },
      "payments": {
        "summary": {
          "amount": {
            "amount": 10,
            "currencyCode": "USD"
          },
          "paymentMethodDisplayString": "Visa ending in 1234",
          "state": "CAPTURED"
        }
      },
      "totalPrice": {
        "value": {
          "amount": 10,
          "currencyCode": "USD"
        }
      },
      "refunds": {
        "details": [
          {
            "id": "example-refund-id",
            "createdAt": "2022-02-03T18:17:19Z",
            "updatedAt": "2022-02-03T18:17:19Z",
            "aliases": {
              "aliasType": "EXTERNAL_ID",
              "aliasId": "example-alias-id"
            },
            "refundTotal": {
              "totalAmount": {
                "amount": 30,
                "currencyCode": "USD"
              }
            },
            "state": "SUCCESS",
            "refundFor": {
              "orderLineItems": [
                {
                  "lineItem": {
                    "id": "example-line-item-id"
                  },
                  "amount": {
                    "value": 1
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}

Returns, refunds, and cancellations

This section contains queries that you can use to get information about the returns, refunds, and cancellations associated with an order.

Get all returns that have been initiated for an order

The following example gets all returns that have been initiated for an order. For possible return states, see ReturnDetails.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    returns {
      details {
        id
        createdAt
        updatedAt
        state
        returnFor {
          orderLineItems {
            lineItem {
              id
            }
            amount {
              value
            }
          }
        }
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "returns": {
        "details": [
          {
            "id": "example-refund-id",
            "createdAt": "2022-02-03T18:17:19Z",
            "updatedAt": "2022-02-03T18:17:19Z",
            "state": "COMPLETED",
            "returnFor": {
              "orderLineItems": [
                {
                  "lineItem": {
                    "id": "example-line-item-id"
                  },
                  "amount": {
                    "value": 1
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}

Get refund details

The following example gets all refunds that are associated with an order. For possible refund states, see RefundDetails.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    lineItems {
      id
      amount {
        unit
        value
      }
      product {
        productId {
          value
        }
        title
        image {
          displayReadyUrl
          sourceUrl
          altText
        }
        price {
          currencyCode
          amount
        }
        variationSelections {
          dimension
          value
        }
      }
    }
    refunds {
      details {
        id
        updatedAt
        state
        refundTotal {
          totalAmount {
            amount
          }
        }
        refundFor {
          orderLineItems {
            lineItem {
              id
            }
            amount {
              value
            }
          }
        }
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          },
          "createdAt": "2024-01-18T18:41:30.569Z",
          "product": {
            "productId": {
              "value": "product-id"
            },
            "title": "example-item-title",
            "image": {
              "displayReadyUrl": "https://example-image.jpeg",
              "altText": "This is a picture of the item",
              "sourceUrl": "https://example-image-url.jpeg"
            },
            "price": {
              "currencyCode": "USD",
              "amount": 10
            },
            "variationSelections": [
              {
                "dimension": "color",
                "value": "red"
              }
            ]
          }
        }
      ],
      "refunds": {
        "details": [
          {
            "id": "example-refund-id",
            "createdAt": "2022-02-03T18:17:19Z",
            "updatedAt": "2022-02-03T18:17:19Z",
            "aliases": {
              "aliasType": "EXTERNAL_ID",
              "aliasId": "example-alias-id"
            },
            "refundTotal": {
              "totalAmount": {
                "amount": 30,
                "currencyCode": "USD"
              }
            },
            "state": "SUCCESS",
            "refundFor": {
              "orderLineItems": [
                {
                  "lineItem": {
                    "id": "example-line-item-id"
                  },
                  "amount": {
                    "value": 1
                  }
                }
              ]
            }
          }
        ]
      }
    }
  }
}

Get all line items that were canceled in an order

The following example gets the line items that were canceled in an order. In this scenario, the query should start from the lineItems object and include fields for cancellation. For a list of possible cancellation reasons, see CancellationDetails. For information about the quantities that were requested for cancellation, see CanceledFor.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    lineItems {
      id
      amount {
        unit
        value
      }
      cancellations {
        details {
          aliases {
            aliasType
            aliasId
          }
          createdAt
          updatedAt
          reason
          requestedBy
          additionalComments
          state
          refundDetails {
            id
            aliases {
              aliasType
              aliasId
            }
            state
            refundTotal {
              totalAmount {
                amount
              }
            }
            paymentDetails {
              id
              amount {
                amount
              }
              paymentMethod {
                displayString
                type
              }
              state
            }
            refundFor {
              orderLineItems {
                lineItem {
                  id
                }
                amount {
                  value
                }
              }
            }
          }
          canceledFor {
            orderLineItems {
              lineItem {
                id
              }
              amount {
                value
              }
            }
          }
        }
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          },
          "cancellations": {
            "details": [
              {
                "aliases": {},
                "createdAt": "2022-02-03T18:17:19Z",
                "updatedAt": "2022-02-03T18:17:19Z",
                "reason": "ORDERED_BY_MISTAKE",
                "requestedBy": "SHOPPER",
                "additionalComments": "",
                "state": "SUCCESS",
                "refundDetails": [
                  {
                    "id": "example-refund-id",
                    "aliases": {
                      "aliasType": "EXTERNAL_ID",
                      "aliasId": "example-alias-id"
                    },
                    "createdAt": "2022-02-03T18:17:19Z",
                    "updatedAt": "2022-02-03T18:17:19Z",
                    "refundTotal": {
                      "totalAmount": {
                        "amount": 30,
                        "currencyCode": "USD"
                      }
                    },
                    "state": "SUCCESS",
                    "refundFor": {
                      "orderLineItems": [
                        {
                          "lineItem": {
                            "id": "example-line-item-id"
                          },
                          "amount": {
                            "value": 1
                          }
                        }
                      ]
                    },
                    "paymentDetails": [
                      {
                        "id": "example-payment-transfer-id",
                        "amount": {
                          "amount": 10
                        },
                        "paymentMethod": {
                          "displayString": "AmazonPay",
                          "type": "AMAZON_PAY"
                        },
                        "state": "SUCCESS",
                        "payer": {
                          "id": "example-payer-id"
                        },
                        "aliases": [],
                        "createdAt": "2022-02-03T18:17:19Z",
                        "updatedAt": "2022-02-04T18:17:19Z"
                      }
                    ]
                  }
                ],
                "canceledFor": {
                  "orderLineItems": [
                    {
                      "lineItem": {
                        "id": "example-line-item-id"
                      },
                      "amount": {
                        "value": 1
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  }
}

Discounts and taxes

This section contains queries that you can use to get information about discounts that are associated with an order.

Get discount details and taxes that have been applied at the order and line-item level for an order

The following example looks for discount details and tax summary information at the order level, line item level, and delivery offer level. For details about discounts, see DiscountAllocationDetails.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    lineItems {
      id
      amount {
        unit
        value
      }
      deliveryOffer {
        details {
          taxes {
            summary {
              collectableTaxAmount {
                amount
                currencyCode
              }
            }
          }
          discounts {
            details {
              amount {
                amount
                currencyCode
              }
              couponCode
              aliases {
                aliasType
              }
              displayString
            }
          }
        }
      }
      taxes {
        summary {
          collectableTaxAmount {
            amount
            currencyCode
          }
        }
      }
      discounts {
        details {
          amount {
            amount
            currencyCode
          }
          couponCode
          aliases {
            aliasType
          }
          displayString
        }
      }
    }
    taxes {
      summary {
        collectableTaxAmount {
          amount
          currencyCode
        }
      }
    }
    discounts {
      details {
        amount {
          amount
          currencyCode
        }
        couponCode
        aliases {
          aliasType
        }
        displayString
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "value": {
            "unit": "ONE",
            "value": 1
          },
          "deliveryOffer": {
            "details": {
              "taxes": {
                "summary": {
                  "collectableTaxAmount": {
                    "amount": 2,
                    "currencyCode": "USD"
                  }
                }
              },
              "discounts": {
                "details": {
                  "amount": {
                    "amount": 1,
                    "currencyCode": "USD"
                  },
                  "displayString": "20% off on orders above $100",
                  "aliases": [],
                  "couponCode": "BWP001"
                }
              }
            }
          },
          "taxes": {
            "summary": {
              "collectableTaxAmount": {
                "amount": 2,
                "currencyCode": "USD"
              }
            }
          },
          "discounts": {
            "details": {
              "amount": {
                "amount": 1,
                "currencyCode": "USD"
              },
              "displayString": "20% off on orders above $100",
              "aliases": [],
              "couponCode": "BWP001"
            }
          }
        }
      ],
      "taxes": {
        "summary": {
          "collectableTaxAmount": {
            "amount": 2,
            "currencyCode": "USD"
          }
        }
      },
      "discounts": {
        "details": {
          "amount": {
            "amount": 1,
            "currencyCode": "USD"
          },
          "displayString": "20% off on orders above $100",
          "aliases": [],
          "couponCode": "BWP001"
        }
      }
    }
  }
}

Get summaries of all discounts and taxes that have been applied at the order and line-item level for an order

Discounts and taxes can be applied at the order level, line item level, and delivery offer level. The following example looks for discount and tax summary information at all levels.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    lineItems {
      id
      amount {
        unit
        value
      }
      deliveryOffer {
        details {
          taxes {
            summary {
              collectableTaxAmount {
                amount
                currencyCode
              }
            }
          }
          discounts {
            summary {
              amount {
                amount
                currencyCode
              }
            }
          }
        }
      }
      taxes {
        summary {
          collectableTaxAmount {
            amount
            currencyCode
          }
        }
      }
      discounts {
        summary {
          amount {
            amount
            currencyCode
          }
        }
      }
    }
    taxes {
      summary {
        collectableTaxAmount {
          amount
          currencyCode
        }
      }
    }
    discounts {
      summary {
        amount {
          amount
          currencyCode
        }
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          },
          "deliveryOffer": {
            "details": {
              "taxes": {
                "summary": {
                  "collectableTaxAmount": {
                    "amount": 2,
                    "currencyCode": "USD"
                  }
                }
              },
              "discounts": {
                "summary": {
                  "amount": {
                    "amount": 1,
                    "currencyCode": "USD"
                  },
                  "displayString": "20% off on orders above $100"
                }
              }
            }
          },
          "taxes": {
            "summary": {
              "collectableTaxAmount": {
                "amount": 2,
                "currencyCode": "USD"
              }
            }
          },
          "discounts": {
            "summary": {
              "amount": {
                "amount": 1,
                "currencyCode": "USD"
              },
              "displayString": "20% off on orders above $100"
            }
          }
        }
      ],
      "taxes": {
        "summary": {
          "collectableTaxAmount": {
            "amount": 2,
            "currencyCode": "USD"
          }
        }
      },
      "discounts": {
        "summary": {
          "amount": {
            "amount": 1,
            "currencyCode": "USD"
          },
          "displayString": "20% off on orders above $100"
        }
      }
    }
  }
}

Customer, products, delivery, and payments

This section contains queries that you can use to get information about the customer, products, delivery, and payments that are associated with an order.

Get customer information for an order

The following example gets the customer information for an order. For details about customer information, see Customer.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    customer {
        contact {
          id
          name
          email
        }
     }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "customer": {
        "contact": {
          "id": "example-contact-id",
          "name": "John Doe",
          "email": "[email protected]"
        }
      }
    }
  }
}

Get product information for all line items in an order

The following example gets the product information for all line items in an order. For details, see LineItem.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    lineItems {
      id
      amount {
        unit
        value
      }
      createdAt
      product {
        productId {
          value
        }
        title
        offerPrime
        productDetailPageUrl
        image {
          displayReadyUrl
          sourceUrl
          altText
        }
        price {
          currencyCode
          amount
        }
        variationSelections {
          dimension
          value
        }
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          },
          "createdAt": "2024-01-18T18:41:30.569Z",
          "product": {
            "productId": {
              "value": "product-id"
            },
            "title": "example-item-title",
            "offerPrime": true,
            "productDetailPageUrl": "https://randomproductdetailpageurl.com",
            "image": {
              "displayReadyUrl": "https://example-image.jpeg",
              "altText": "This is a picture of the item",
              "sourceUrl": "https://example-image-url.jpeg"
            },
            "price": {
              "currencyCode": "USD",
              "amount": 10
            },
            "variationSelections": [
              {
                "dimension": "color",
                "value": "red"
              }
            ]
          }
        }
      ]
    }
  }
}

Get delivery information for all line items in an order

The following example gets delivery information for all line items in an order. You can query for both DeliveryInformationSummary (minimal details like delivery state) and DeliveryInformationDetails (delivery state, estimated delivery date, tracking details, and so on). If an order only has summary information, the details will be empty.

Request
query order {
  order(
    orderIdentifier: {
      alias: { aliasType: "EXTERNAL_ID", aliasId: "example-alias-id" }
    }
  ) {
    id
    lineItems {
      id
      amount {
        unit
        value
      }
      deliveryInformation {
        summary {
          state
        }
        details {
          state
          reason
          estimatedDeliveryDate
          deliverFromAddress {
            name
            streetAddress
            locality
            region
            countryCode
            postalCode
          }
           deliveryInformationDetailsFor {
            orderLineItems {
              lineItem {
                id
              }
              amount {
                value
              }
            }
          }
          trackingDetails {
            trackingId
            carrierCode
          }
        }
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          },
          "deliveryInformation": {
            "summary": {
              "state": "PENDING"
            },
            "details": [
              {
                "state": "PENDING",
                "reason": null,
                "estimatedDeliveryDate": "2024-01-11",
                "deliverFromAddress": {
                  "name": "John Doe",
                  "streetAddress": "440 Terry Ave N",
                  "locality": "Seattle",
                  "region": "WA",
                  "countryCode": "US",
                  "postalCode": "98109"
                },
                "deliveryInformationDetailsFor": {
                  "orderLineItems": [
                    {
                      "lineItem": {
                        "id": "example-line-item-id"
                      },
                      "amount": {
                        "value": 1
                      }
                    }
                  ]
                },
                "trackingDetails": {
                  "trackingId": "example-tracking-id",
                  "carrierCode": "UPS"
                }
              }
            ]
          }
        }
      ]
    }
  }
}

Get all payments that have been applied at the order and line-item level for an order

While you create or update an order, you can input either a PaymentSummary that captures a summary of all payment transactions at the order and line-item level, or you can enter PaymentDetails to capture detailed information for each payment transaction. You can query for both summary and details, but the response contains either summary or details depending on what you passed in when you created or updated the order.

The following example gets payments at the order and line-item level in the case where the order was created with only a PaymentSummary at the line-item level.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    lineItems {
      id
      amount {
        unit
        value
      }
      payments {
        summary {
          amount {
            amount
          }
          paymentMethodDisplayString
          state
        }
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          },
          "payments": {
            "summary": {
              "amount": {
                "amount": 10,
                "currencyCode": "USD"
              },
              "paymentMethodDisplayString": "Visa ending in 1234",
              "state": "CAPTURED"
            }
          }
        }
      ]
    }
  }
}

The following example gets payments at the order and line-item level in the case where the order was created with a PaymentSummary at both the line-item level ($10 payment) and order level ($20 payment).

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    lineItems {
      id
      amount {
        unit
        value
      }
      payments {
        summary {
          amount {
            amount
            currencyCode
          }
          paymentMethodDisplayString
          state
        }
      }
    }
    payments {
      summary {
        amount {
          amount
          currencyCode
        }
        paymentMethodDisplayString
        state
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          },
          "payments": {
            "summary": {
              "amount": {
                "amount": 10,
                "currencyCode": "USD"
              },
              "paymentMethodDisplayString": "Visa ending in 1234",
              "state": "CAPTURED"
            }
          }
        }
      ],
      "payments": {
        "summary": {
          "amount": {
            "amount": 20,
            "currencyCode": "USD"
          },
          "paymentMethodDisplayString": "Visa ending in 1234",
          "state": "CAPTURED"
        }
      }
    }
  }
}

The following example gets payments at the order and line-item level in the case where the order was created with PaymentDetails at the order level.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    lineItems {
      id
      amount {
        unit
        value
      }
      payments {
        details {
          id
          amount {
            amount
          }
          paymentMethod {
            displayString
            type
          }
          state
          payer {
            id
          }
          aliases {
            aliasType
            aliasId
          }
          createdAt
          updatedAt
        }
      }
    }
    payments {
      details {
        id
        amount {
          amount
        }
        paymentMethod {
          displayString
          type
        }
        state
        payer {
          id
        }
        aliases {
          aliasType
          aliasId
        }
        createdAt
        updatedAt
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          },
          "payments": {
            "details": []
          }
        }
      ],
      "payments": {
        "details": [
          {
            "id": "example-payment-transfer-id",
            "amount": {
              "amount": 10
            },
            "paymentMethod": {
              "displayString": "AmazonPay",
              "type": "AMAZON_PAY"
            },
            "state": "SUCCESS",
            "payer": {
              "id": "amzn1.account.ABCDE12345"
            },
            "aliases": [],
            "createdAt": "2022-02-03T18:17:19Z",
            "updatedAt": "2022-02-04T18:17:19Z"
          }
        ]
      }
    }
  }
}

Overall order

This section contains queries that you can use to retrieve overall details about the order.

Get an order with the specified alias

An alias is an external ID, such as the order number in your own system, that you can optionally include when you create an order with the Order API. The following query gets an order with the specified alias. To query an order that has an alias, pass orderIdentifier in the query input. Note that the query input takes either an orderIdentifier (an alias) or an orderId (Buy with Prime order ID), never both.

Request
query order {
  order(
    orderIdentifier: {
      alias: { aliasType: "EXTERNAL_ID", aliasId: "example-alias-id" }
    }
  ) {
    id
    lineItems {
      id
      amount {
        unit
        value
      }
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "lineItems": [
        {
          "id": "example-line-item-id",
          "amount": {
            "unit": "ONE",
            "value": 1
          }
        }
      ]
    }
  }
}

Get the order total, execution state, and last updated time for an order

The following example gets general information about an order. For details about order metadata, see OrderMetadata.

Request
query order {
  order(orderIdentifier: {orderId: "example-order-id"}) {
    id
    totalPrice {
      value {
        amount
        currencyCode
      }
    }
    metadata {
      executionState
      createdAt
      updatedAt
    }
  }
}
Response
{
  "data": {
    "order": {
      "id": "example-order-id",
      "totalPrice": {
        "value": {
          "amount": 10,
          "currencyCode": "USD"
        }
      },
      "metadata": {
        "executionState": "NOT_STARTED",
        "createdAt": "2024-01-18T18:41:30.610Z",
        "updatedAt": "2024-01-18T18:41:30.610Z"
      }
    }
  }
}

Related topics