When called for a not submitted cart, Checkout.status will always be PENDING. After cart submission Checkout.status will change according to the current checkout state.

Sometimes, when using the checkoutByCartID 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 casse in the 3D-S Challenge guide.


Arguments

cartID
ID!
required

The ID of the Cart

Returns

Checkout.*

Any requested field from the Checkout object.

Example - request

Query arguments

{
    "cartID": "{{cartId}}"
}
GraphQL
query Checkout($cartID: ID!){
  checkoutByCartID(cartID: $cartID) {
    status
    orders {
      id
      status
      events {
        __typename
        id
        createdAt
        ... on OrderFailedOrderEvent { reason }
      }
      requiredActions {
        ... on CompletePaymentChallenge {
          redirectURL
        }
      }
    }
    cart {
      id
      stores {
        ... on AmazonStore {
          store
          requestId
          cartLines {
            product {
              id
            }
            quantity
          }
          offer {
            shippingMethods {
              id
              total {
                displayValue
              }
            }
          }
          errors {
            message
          }
          isSubmitted
        }
        ... on ShopifyStore {
          store
          requestId
          cartLines {
            variant {
              id
            }
            quantity
          }
          offer {
            shippingMethods {
              id
              total {
                displayValue
              }
            }
          }
          errors {
            message
          }
          isSubmitted
        }
      }
      buyerIdentity {
        firstName
        lastName
      }
    }
  }
}

Example - response

Response
{
    "data": {
        "checkoutByCartID": {
            "status": "PENDING",
            "orders": [
                {
                    "id": "cf3edbe2-a4fb-48d8-a4bb-5a7f39929efa",
                    "status": "PENDING",
                    "events": [],
                    "requiredActions": []
                },
                {
                    "id": "e442d899-0812-48e7-b6d9-c659f3b034de",
                    "status": "PENDING",
                    "events": [],
                    "requiredActions": []
                }
            ],
            "cart": {
                "id": "teWvPufPy8c2AcfkfBo9",
                "stores": [
                    {
                        "store": "test.myshopify.com",
                        "requestId": "cf3edbe2-a4fb-48d8-a4bb-5a7f39929efa",
                        "cartLines": [
                            {
                                "variant": {
                                    "id": "44454219743530"
                                },
                                "quantity": 1
                            }
                        ],
                        "offer": {
                            "shippingMethods": [
                                {
                                    "id": "79da7f8d68e18f7616e6841112693fce",
                                    "total": {
                                        "displayValue": "$12.39"
                                    }
                                },
                                {
                                    "id": "ee768830e386b87e4f230f4292c237a3",
                                    "total": {
                                        "displayValue": "$14.39"
                                    }
                                }
                            ]
                        },
                        "errors": [],
                        "isSubmitted": false
                    },
                    {
                        "store": "amazon",
                        "requestId": "e442d899-0812-48e7-b6d9-c659f3b034de",
                        "cartLines": [
                            {
                                "product": {
                                    "id": "B00A2KD8NY"
                                },
                                "quantity": 1
                            }
                        ],
                        "offer": {
                            "shippingMethods": [
                                {
                                    "id": "3.99-Default shipping method",
                                    "total": {
                                        "displayValue": "$11.94"
                                    }
                                }
                            ]
                        },
                        "errors": [],
                        "isSubmitted": false
                    }
                ],
                "buyerIdentity": {
                    "firstName": "John",
                    "lastName": "Doe"
                }
            }
        }
    }
}

Errors

If the cart is not found then a corresponding error is returned

JSON
{
    "errors": [
        {
            "message": "Cart not found: someInvalidCartId",
            "path": [
                "checkoutByCartID"
            ],
            "extensions": {
                "code": "CART_NOT_FOUND_ERROR"
            }
        }
    ],
    "data": null
}

If the cart is expired (older than 10 days) then a corresponding error is returned

JSON
{
    "errors": [
        {
            "message": "Cart expired: someExpiredCartId",
            "path": [
                "checkoutByCartID"
            ],
            "extensions": {
                "code": "CART_EXPIRED_ERROR"
            }
        }
    ],
    "data": null
}

orderById