question

rajesh avatar image
rajesh asked anthonytran answered

Line Items are not creating when I place/create a new order using rest API

Line Items are not creating when I place/create a new order using rest API. I am also sending line items in request payload

Request Payload

{ "note": "sampledata", "title": "sampleorder", "lineItems": [ { "note": "sampleItems1", "item": { "id": "B0NCCHN498ZTC" }, "price": "230", "name": "sample1", "unitQty": "2" }, { "note": "sampleItems2", "item": { "id": "72DH91BP4XGSE" }, "price": "200", "name": "sample2", "unitQty": "10" } ], "total": "2300", "customers": [ { "id": "123456" } ], "testMode":true }

OrdersLineItems
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rachel avatar image
rachel Deactivated answered

Hi @rajesh,

The /v3/merchants/{mId}/orders endpoint only supports basic order creation. Valid fields are limited to taxRemoved, note, title, and orderType. Adding line items must be done in separate calls to /v3/merchants/{mId}/orders/{orderId}/line_items. Check out how to work with orders.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

daveip avatar image
daveip answered shahnawazrajper commented
How do you actually create a line item using the web api? I keep getting "invalid line item"
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

shahnawazrajper avatar image shahnawazrajper commented ·

Hi !

daveip@hotmail.com have you found the solution for Invalid line item using web api ?

0 Likes 0 ·
Lee Tickett avatar image
Lee Tickett answered
See this post for a demonstration of creating an order and lineitem via the API; https://community.clover.com/questions/17217/invalid-line-item.html

The bare minimum i've found you really need is;
POST /orders
{"state":"open","total":1000}
POST /orders/ORDERID/line_items
{"name": "test","price" : 1000}
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

anthonytran avatar image
anthonytran answered

Good to know. Probably worth updating the docs: https://docs.clover.com/clover-platform/reference#ordercreateorder-2 as lineItems seems to show up as a field that you can post.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community