> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: "orderByID"
description: "Returns an Order object by ID. This query can be used to retrieve information about the individual order."
---

Sometimes, when using the `orderByID` query, the returned status may be `ACTION_REQUIRED`. In this case, you should check the `requiredActions` field for each order with this status and perform the necessary actions. Currently, there is only one required action: `CompletePaymentChallenge`, also known as 3D-S Challenge. You can learn more about this use case in the [3D-S Challenge](/3ds-challenge) guide.

<Note>
  Cart [`Store`](/api-reference/store) objects have an `orderId` field which can be used to look up orders. This lookup only works *after* the cart has been submitted. Prior to calling [`submitCart`](/api-reference/submitcart), `orderByID` will return `null`.
</Note>

***

### Arguments

<ParamField path="id" type="ID!" required>
  The ID of the [`Order`](/api-reference/order)
</ParamField>

### Returns

<ParamField path="Order.*" type={<a href="/api-reference/order">Order</a>}>
  Any requested field from the [`Order`](/api-reference/order) object.
</ParamField>

***

### Example - request

```json Query arguments
{
  "id": "{{orderId}}"
}
```

```GraphQL GraphQL
query OrderById($id: ID!) {
  orderByID(id: $id) {
    id
    status
    createdAt
    cart {
      id
      attributes {
        key
        value
      }
      buyerIdentity {
        firstName
        lastName
        email
        phone
        address1
        address2
        city
        provinceCode
        countryCode
        postalCode
      }
      stores {
        ... on AmazonStore {
          store
          cartLines {
            product {
              title
              images {
                url
              }
            }
          }
        }
        ... on ShopifyStore {
          store
          cartLines {
            variant {
              name
              title
              SKU
              image {
                url
              }
            }
            product {
              title
              productType
              description
              descriptionHTML
              images {
                url
              }
            }
          }
        }
      }
    }
    returns {
      id
      shippingLabelUrl
      orderId
      marketplace
      marketplaceOrderId
      lineItems {
        ... on AmazonReturnLineItem {
          productId
          status
          quantity
        }
        ... on ShopifyReturnLineItem {
          variantId
          quantity
          status
        }
      }
    }
    shipments {
      carrierName
      carrierTrackingNumber
      carrierTrackingUrl
    }
    marketplaceOrderIds
    marketplace
    events {
      id
      createdAt
      ... on OrderFailedOrderEvent {
        reason
      }
    }
    requiredActions {
    	... on CompletePaymentChallenge {
    		redirectURL
    	}
    }
  }
}
```

### Example - response

```json Response
{
  "data": {
    "orderByID": {
      "id": "00401732-8a19-48eb-be6a-6138d2f666c7",
      "status": "SUCCEEDED",
      "createdAt": "2024-08-29T13:18:36.601Z",
      "cart": {
        "id": "QDalahoAg49Fg0rqHGQl",
        "attributes": [],
        "buyerIdentity": {
          "firstName": "John",
          "lastName": "Doe",
          "email": "dev@rye.com",
          "phone": "+14254493139",
          "address1": "90 Ruland Road",
          "address2": "",
          "city": "Melville",
          "provinceCode": "NY",
          "countryCode": "US",
          "postalCode": "11747"
        },
        "stores": [
          {
            "store": "amazon",
            "cartLines": [
              {
                "product": {
                  "title": " Macbook Pro",
                  "images": []
                }
              }
            ]
          }
        ]
      },
      "returns": [
        {
          "id": "bd93158b-3abb-411a-bc62-b1fbd786cb61",
          "shippingLabelUrl": null,
          "orderId": "00401732-8a19-48eb-be6a-6138d2f666c7",
          "marketplace": "AMAZON",
          "lineItems": [
            {
              "productId": "B0BFX4SC26",
              "status": "RETURN_REQUEST_ACCEPTED",
              "quantity": 1
            },
            {
              "productId": "B0C68W65D3",
              "status": "RETURN_REQUEST_ACCEPTED",
              "quantity": 1
            }
          ]
        },
        {
          "id": "e64e4fb9-57ed-4618-89db-3a1e48911cf2",
          "shippingLabelUrl": "http://0.0.0.0:8086/v0/b/returns/o/shipping-labels%2Fdeveloper_1%2Fe64e4fb9-57ed-4618-89db-3a1e48911cf2.JPEG?alt=media&token=ae133b02-b4b7-48e9-842b-ff42ff62c2ae",
          "marketplace": "AMAZON",
          "lineItems": [
            {
              "productId": "B01AXM4WV2",
              "status": "RETURN_APPROVED",
              "quantity": 1
            }
          ]
        }
      ],
      "shipments": [
        {
          "carrierName": "Amazon Logistics",
          "carrierTrackingNumber": "TBA311028147972",
          "carrierTrackingUrl": ""
        }
      ],
      "marketplaceOrderIds": [
        "113-3556219-4623416"
      ],
      "marketplace": "AMAZON",
      "events": [
        {
          "__typename": "OrderSubmissionStartedOrderEvent",
          "id": "71780cad-75b1-4319-b25f-813fd82ee8b4",
          "createdAt": "2023-11-17T23:10:53.230Z"
        },
        {
          "__typename": "OrderSubmissionSucceededOrderEvent",
          "id": "96bdad41-bab2-4e00-9535-a39d65c67f34",
          "createdAt": "2023-11-17T23:10:53.294Z"
        },
        {
          "__typename": "OrderPlacedOrderEvent",
          "id": "7e50d783-d03b-4e87-8f65-b3b1a1ad5f0d",
          "createdAt": "2023-11-17T23:10:53.417Z"
        },
        {
          "__typename": "TrackingObtainedOrderEvent",
          "id": "064ad865-d19a-486c-b699-bc04e3f0fc36",
          "createdAt": "2023-11-18T22:30:22.081Z"
        },
        {
          "__typename": "ReturnRequestedOrderEvent",
          "id": "80daa90b-2c02-4c2c-b241-dfdd7e485904",
          "createdAt": "2024-02-15T16:01:24.420Z"
        },
        {
          "__typename": "ReturnRequestedOrderEvent",
          "id": "1b2618fd-8cd8-4e3e-929e-3612b657edd1",
          "createdAt": "2024-02-15T16:01:24.427Z"
        },
        {
          "__typename": "ReturnRequestAcceptedOrderEvent",
          "id": "2f5c8f80-b617-42cf-ab68-41667b210b3f",
          "createdAt": "2024-02-15T16:01:24.507Z"
        },
        {
          "__typename": "ReturnRequestAcceptedOrderEvent",
          "id": "fb099f13-74cc-4294-bd53-136b6b365124",
          "createdAt": "2024-02-15T16:01:24.511Z"
        }
      ],
      "requiredActions": []
    }
  }
}
```

***

### Related queries

[`checkoutByCartID`](/api-reference/orderbyid)


---

*Powered by [holocron.so](https://holocron.so)*
