Unable to add lineitems to checkout using checkout api

15 0 0

I'm trying to create a checkout using Checkout API, my app is a sales channel and has the access of "writing_checkouts". The product is listed on the sales channel but when I try to create a checkout, the request-response in 200, return a complete checkout object, but there is no field added like email, line_items or shipping address. Here is the example code:

 $field = array(
        "email"=> "john.smith@example.com",
        "line_items"=> array(array(
          "variant_id"=> 31520093667373,
          "quantity"=> 1
        "shipping_address"=> array(
          "first_name"=> "John",
          "last_name"=> "Smith",
          "address1"=> "126 York St.",
          "city"=> "Ottawa",
          "province_code"=> "ON",
          "country_code"=> "CA",
          "phone"=> "(123)456-7890",
          "zip"=> "K1N 5T5"
    $data = json_encode($field);
    $curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_URL => $url,
        CURLOPT_HTTPHEADER => array(
            "Authorization: Basic Og==",
            "accept: application/json",
            "content-type: application/graphql",
            "X-Shopify-Access-Token: ********************************",
        CURLOPT_POSTFIELDS=> $postFields
    $response = curl_exec($curl);
    $err = curl_error($curl);    
    if ($err) {
        echo $err;
    } else {
        echo $response;

and this is the response I'm gettin:

Reply 1 (1)

Shopify Staff (Retired)
51 10 7

Hi there, 


If you are still experiencing this issue, would you be able to provide the 'x-request-id' header from the response to any of the requests you have made to the Checkout API. This will allow me to check our internal logs. 



To learn more visit the Shopify Help Center or the Community Blog.