question

rajesh avatar image
rajesh asked ·

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 characters needed characters left characters exceeded

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 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.

Share
10 |2000 characters needed characters left characters exceeded

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

anthony.tran avatar image
anthony.tran 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.

Share
10 |2000 characters needed characters left characters exceeded

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

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}
Share
10 |2000 characters needed characters left characters exceeded

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

daveip@hotmail.com avatar image
daveip@hotmail.com answered ·
How do you actually create a line item using the web api? I keep getting "invalid line item"
1 comment Share
10 |2000 characters needed characters left characters exceeded

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

Hi !

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

0 Likes 0 · ·

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