Create order via Shopify Api

Solved
Highlighted
Tourist
5 1 0

Hi there

I am creating the order via shopify api but error  messege show. Please give me suitable solution for this issue.

 

[response] => {"errors":{"order":"Required parameter missing or invalid"}}

 

0 Likes
Highlighted
Shopify Partner
1777 211 370

Please post the exact URL you are POSTing to as well as the payload you are sending. From the error I can tell the payload is malformed for sure. This below would be the simplest payload you should be able to create an order with:

{
  "order": {
    "line_items": [
      {
        "variant_id": 447654529,
        "quantity": 1
      }
    ]
  }
}
Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
Highlighted
Tourist
5 1 0

     This is my post data: 

 

$array = array("order"=>array(
"line_items"=>array(
 
 
),
)
);
 
  for($i=0; $i<count($_POST['varient']); $i++){
  $varient=intval($_POST['varient'][$i]);
  $quantity=intval($_POST['quantity'][$i]);
       $array["order"]['line_items'][] = array(
"variant_id"=>'31899693875259',
"product_id"=>intval($_POST['product_id'][$i]),
"vendor"=>"https://rentaltest",
"quantity"=>'1'
);
  }
 
shopify_call($token,$shop,"/admin/api/2020-01/orders.json",json_encode($array),"POST");

0 Likes
Highlighted
Tourist
5 1 0

This is an accepted solution.

Please give me suitable solution for this error. I am getting this error again and again.

 

    [response] => {"errors":{"order":"Required parameter missing or invalid"}}

 

 

0 Likes
Highlighted
Tourist
5 1 0

,

I am getting this error again and again. Please give me suitable solution for this issue.

[response] => {"errors":{"order":"Required parameter missing or invalid"}}

 I am posting the varient id and quantity in the post parameter of create order api and i am sending you screenshot of my page. Please have a look

and give me suitable solution for this error. Thanks

https   https-rentaltest myshopify com apps checkout bbba266a5f8266235ac0a03fcce81630.png

0 Likes
Highlighted
Shopify Partner
1777 211 370
Make sure you set content-type header to application/json when POSTing the payload.
Sergiu Svinarciuc | CTO @ visely.io
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
- To learn more about the awesome stuff we do head over to visely.io or our blog
0 Likes
Highlighted
Tourist
5 1 0

Thanks dear,

 

This is working fine now.

0 Likes