When called for a not submitted cart, Order.status will always be PENDING and Order.events array will be empty. After cart submission Order.status will change according to the current checkout state and the Order.events array will be populated.

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 guide.


This query returns a successful response even if an invalid order ID is provided


Arguments

id
ID!
required

The ID of the Order

Returns

Order.*

Any requested field from the Order object.


Example - request

Query arguments
{
  "id": "{{orderId}}"
}
GraphQL
query OrderById($id: ID!) {
  orderByID(id: $id) {
    id
    returns {
      id
      shippingLabelUrl
      orderId
      marketplace
      marketplaceOrderId
      lineItems {
        ... on AmazonReturnLineItem {
          productId
          status
          quantity
        }
        ... on ShopifyReturnLineItem {
          variantId
          quantity
          status
        }
      }
    }
    status
    shipments {
      carrierName
      carrierTrackingNumber
      carrierTrackingUrl
    }
    marketplaceOrderIds
    marketplace
    events {
      id
      createdAt
      ... on OrderFailedOrderEvent {
        reason
      }
    }
    requiredActions {
    	... on CompletePaymentChallenge {
    		redirectURL
    	}
    }
  }
}

Example - response

Response
{
  "data": {
    "orderByID": {
      "id": "00401732-8a19-48eb-be6a-6138d2f666c7",
      "status": "SUCCEEDED",
      "returns": [
        {
          "id": "bd93158b-3abb-411a-bc62-b1fbd786cb61",
          "shippingLabelUrl": null,
          "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",
          "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": []
    }
  }
}

checkoutByCartID