Error 422 when creating Checkout

I’m trying to create a checkout object. I’m using the shopify python 8.4.1 with API version 2021-04.

shopify.Checkout.create({"checkout": {"email": "jelo@bld.ai", "line_items": [ {"variant_id": 41075752632483, "quantity": 1} ]}})

I’m receiving the following error:

{
  "errors": {
    "line_items": {
      "0": {
        "variant_id": [
          {
            "code": "invalid",
            "message": "is invalid",
            "options": {}
          }
        ]
      }
    }
  }
}

My X-Request-ID is: 7be4f98a-60c0-471a-a126-b388182a1dba

So it looks like you need to either (1) add products to your sales channel app via Admin API or (2) add your sales channel app manually from the store product page (see screenshot).


I hope there was a guide that pointed me here. I only found a relevant thread that gave me the idea.

Also, it would have saved me a couple of days of work if the error message is a bit more descriptive like: "This product is not yet included in your product listing. See ProductListing resource for more information: https://shopify.dev/api/admin/rest/reference/sales-channels/productlisting"