How to get checkoutId like "gid://shopify/Checkout/35072706281695qwerty"

There are many api of checkout with required checkoutId but no document about how to get checkoutId.

Hi Sodoo,

When you use the API to create a new checkout, the response typically includes a checkout ID. For example, in Shopify, when you create a new checkout using the Storefront API, the returned Checkout object includes an id field which is your checkout ID.

Here is a mutation example using GraphQL:

mutation {
  checkoutCreate(input: { 
    lineItems: [{ variantId: "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8yOTEwNjAyMzY5NTA=", quantity: 1 }] 
  }) {
    checkout {
      id
    }
  }
}

In the response, you’ll get something like:

{
  "data": {
    "checkoutCreate": {
      "checkout": {
        "id": "Z2lkOi8vc2hvcGlmeS9DaGVja291dC9kMTZmM2EzMDM4YjMzNzFlOWZjMWE3MmNjNGQ5ZDk3Mz9rZXk9YjdlMmZmMjg1YzgwZDdlNmE1ZDc4YWM5ZGY3YmE4MTE="
      }
    }
  }
}

The value of id is the checkout ID you need.

Hope this helps!

1 Like

Hello Liam is it possible to get numeric checkout id wichh we can see in admin orders at the end of the page #37947591590172 like this