Add lines to a sale

Adds lines to an unpaid or part-paid sale. This only adds lines — you can't remove or edit existing ones this way. For edits, deletes and adding lines in one request, use Edit sale lines.

A line with a negative quantity and no linked_sale_line_id is an adjustment line, and is allowed on unpaid and part-paid sales. Quantity can be positive or negative; it just can't be 0.

An unpaid return can also have lines added: that's a sale with a negative total, no payments and no linked return lines, usually stored as overpaid. Its status is recalculated and may become unpaid or overpaid. A sale that's a return or refund (it has lines linked to another sale) can't have lines added. Any other net-negative sale, such as one that already has payments, also can't.

Send an array of lines, or an object {"lines":[...]}. Each line has the same shape as lines on Create a sale: item_id or barcode, quantity, item_price, item_tax, item_discount, item_discount_reason, item_loyalty, item_promotions, serial_number and metadata. Promotions go in item_promotions (an array). The older item_promotion_id and item_promotion_name fields are used only when item_promotions is empty.

Don't include id on a line — that would be editing an existing line. Don't include linked_sale_line_id — returns can't be added to an existing sale this way.

The response is the updated sale, in the same shape as Get a sale. New lines get created, local_created and created_by set to now.

Adding lines fires a sale_lines_add system hook, and giftcard_create if any gift cards were created. If the add changes the sale's status, it also fires sale_update with {before, after}. If the sale becomes paid, each Inactive fulfillment is opened and a fulfillment_status_change hook fires with {before, after} for that fulfillment. Becoming overpaid doesn't open fulfillments. The sale_lines_add payload is {sale_id, lines, sale, before}: lines is only the lines that were added (with their new IDs), sale is the full sale after the change, and before is the sale before the change.

Required permission:

GroupPermission
SalesCreate, edit and delete sales; manage = create sales and change their staff member or customer (includes view)
Path Params
int64
required

ID of the sale.

Body Params

The lines to add.

string

Item barcode.

integer

Don't send this when adding lines. A line with id returns a 400 with existing sale lines cannot be edited (remove id) on line N (N is the 1-based line number).

item
object
number

Discount on this line. Send 0 for none.

string

Discount reason. Send "" for none.

integer

ID of the item (variant) sold. It's an items[].id from a product.

number

Loyalty value used. Send 0 for none.

number

Price per unit.

item_promotions
array of objects

Promotions applied to this line. This is the primary way to send and read promotions. If it's empty or omitted, Smooth POS uses the legacy item_promotion_id and item_promotion_name fields instead.

item_promotions
integer

Legacy. ID of the promotion applied, or 0. Used only when item_promotions is empty.

string

Legacy. Name of the promotion applied, or "". Used only when item_promotions is empty.

string

Return reason. Send "" on normal lines.

number

Tax on this line.

linked_sale_line
object
integer

Don't send this when adding lines. A line with linked_sale_line_id returns a 400 with returns cannot be added to an existing sale on line N (N is the 1-based line number).

integer

Loyalty points earned on this line. Send 0 for none.

metadata
object
boolean
product
object
integer
required

Number of units. Can be positive or negative — a negative quantity without linked_sale_line_id is an adjustment line. Can't be 0.

integer
integer
string

Serial number of the unit sold, for serialised items.

tags
array of strings
tags
number
number
number
number
boolean

true if a returned item was marked faulty.

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json