Storefront API - createCart() generates checkout URL that redirects to login page

Hi.

I’ve recently managed to use the createCart() function to generate a checkout url for the user. For context on how I call the function, I use a library in .NET to send a GraphQL message to the Storefront API. The message also includes the Shopify-Storefront-Private-Token and Shopify-Storefront-Buyer-IP headers. I’ve also used /api/2023-01 and /api/2024-10 for the Storefront API version - both having the same behavior on the checkout url.

When I visit the checkout url where my browser doesn’t have any user logged in to the shopify store, I get redirected to the login page; however, if I re-open the same checkout url or even generate a new one, it only then redirects me to the checkout page without having to manually log in.

I tried disabling the Require customers to log in to their account before checkout option in the Checkout settings in the Shopify Admin site, and it now always has the user logged in automatically even after logging out.

A few or several days ago, this was not the case; when visiting the checkout url for the first time or even after logging out from the Shopify store, it automatically logs in the user. No other configurations were made as far as I’m aware. Could there be changes needed without having to disable the login requirement, or is there a changelog we could refer that covers this scenario? If so, please let me know where to find it; otherwise, any advise will be of great help.

An update regarding this: It turns out even when sending an API request via Postman, the same behavior occurs.

I then tried removing the Shopify-Storefront-Buyer-IP header, and it also has a similar outcome.

I’m still figuring out whether there is a data mismatch between the checkout page and the request I’ve sent to the API or said request has missing data. Here are the contents of the request:

Store URL
https://[insert_shopify_store_url]/api/2024-10/graphql.json

Headers
Shopify-Storefront-Private-Token
Shopify-Storefront-Buyer-IP

GraphQL query

mutation createCart($cartInput: CartInput) {
  cartCreate(input: $cartInput) {
    cart {
      id
      createdAt
      updatedAt
      checkoutUrl
    }
    userErrors {
      code
      field
      message
    }
  }
}

GraphQL variables

{
  "cartInput": {
    "buyerIdentity": {
        "customerAccessToken": "[insert_token]"
    },
    "lines": [
        {
            "quantity": 1,
            "merchandiseId": "[insert_id]",
            "sellingPlanId": "[insert_id]"
        }
    ]
  }
}

Did you ever find a solution to this? Coming across a similar issue.