Create checkout mutation has error

Fydez
Shopify Partner
8 0 0

this is my mutation for create checkout:

mutation checkoutCreate($input: CheckoutCreateInput!) {
              checkoutCreate(input: $input) {
                checkout {
                  id
                }
                checkoutUserErrors {
                      code
                      field
                      message
                }
                queueToken
              }
            }

and input variables is :

{
    "input": {
        "allowPartialAddresses": false,
        "buyerIdentity": {
            "countryCode": "AU"
        },
        "customAttributes": [
            {
                "key": "",
                "value": ""
            }
        ],
        "email": "Karimy.ehsan@gmail.com",
        "note": "test",
        "presentmentCurrencyCode": "AU",
        "shippingAddress": {
            "address1": "15 Barker Street",
            "address2": "",
            "city": "Forest Hill",
            "company": "",
            "country": "Australia",
            "firstName": "Ehsan",
            "lastName": "karimi",
            "phone": "(08) 9073 4623",
            "province": "Western Australia",
            "zip": "6324"
        },
        "lineItems": [
            {
                "customAttributes": [
                    {
                        "key": "",
                        "value": ""
                    }
                ],
                "quantity": 1,
                "variantId": "gid://shopify/ProductVariant/46850414182711"
            }
        ]
    },
    "queueToken": ""
}

and response error is :

{
    "errors": [
        {
            "message": "CheckoutCreateInput isn't a defined input type (on $input)",
            "locations": [
                {
                    "line": 1,
                    "column": 25
                }
            ],
            "path": [
                "mutation checkoutCreate"
            ],
            "extensions": {
                "code": "variableRequiresValidType",
                "typeName": "CheckoutCreateInput",
                "variableName": "input"
            }
        },
        {
            "message": "Field 'checkoutCreate' doesn't exist on type 'Mutation'",
            "locations": [
                {
                    "line": 3,
                    "column": 15
                }
            ],
            "path": [
                "mutation checkoutCreate",
                "checkoutCreate"
            ],
            "extensions": {
                "code": "undefinedField",
                "typeName": "Mutation",
                "fieldName": "checkoutCreate"
            }
        },
        {
            "message": "Variable $input is declared by checkoutCreate but not used",
            "locations": [
                {
                    "line": 1,
                    "column": 1
                }
            ],
            "path": [
                "mutation checkoutCreate"
            ],
            "extensions": {
                "code": "variableNotUsed",
                "variableName": "input"
            }
        }
    ]
}

the post URL is : https://fydez.myshopify.com/admin/api/2023-07/graphql.json
I don't know why receiving this error!!!!!

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1412 231 484

Hey @Fydez , I've responded over on your original post here: https://community.shopify.com/c/graphql-basics-and/create-checkout/m-p/2295003#M11874 

 

- Kyle G. 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog