Issue with Shopify Checkout API and Prefilling User Data

Dear Shopify Support Team,

I am currently facing an issue while integrating the Shopify Checkout API. I am attempting to create a checkout session and prefill user data before redirecting to the Shopify checkout page, but it is not working as expected.

Here are the details of my API call:

API Request:

curl --verbose --location 'https://mystore.myshopify.com/admin/api/2023-01/checkouts.json' \
--header 'X-Shopify-Access-Token: {{adminToken}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "checkout": {
        "email": "test@example.com",
        "line_items": [
            {
                "variant_id": 42340311335014,
                "quantity": 1
            }
        ]
    }
}'

Issue:

  1. The API response I receive is as follows:
{
    "checkouts": []
}

This response does not include a valid checkout session or any checkout details.
2. While the user email (test@example.com) is prefilled when redirecting to the Shopify checkout page, I am unable to prefill other important fields such as:

  • Shipping Address
  • Billing Address
  • Phone Number
  1. Additionally, I am unsure about the correct approach to pass product data to the checkout page effectively.

Expected Behavior:

When users are redirected to the Shopify checkout page, I would like the following details to be prefilled:

  • Email
  • Shipping Address
  • Billing Address
  • Phone Number

Questions:

  1. Is it possible to prefill all these details on the Shopify checkout page using this API?
  2. If yes, could you please provide the correct API payload or additional steps required to achieve this functionality?
  3. If no, what alternative methods are available to prefill these details during the checkout process?
  4. Could you also clarify what is required to pass product data effectively to the checkout page?

Additional Information:

I would greatly appreciate your guidance and support in resolving this issue.

Thank you in advance for your assistance.

Hey,

You are using a extremely out of date endpoint, the API Version in your request is 2023-01, which is now 2 years out of date. It also looks like a REST API endpoint which is deprecated.

You could look at the Storefront API cartCreate - Storefront API

Or the AJAX API About the Shopify Ajax API

Depending on where you are working with the cart

1 Like