Library
sale.create Schema
Contains details of a sale to be created or stored into Fieldpine.
There are different schema definitions for creating a sale vs reading a sale details. They are very similar and most fields are identical in the two structures, however both have specific fields unique to them, so keeping them as seperate concepts is logically easier.
Top Level Fields
| Field | Datatype | Flags | Description | How to Alter with Salesbuilder |
| lines | Array | Items being purchased or returned. | fd1.salesbuilder.product.add fd1.salesbuilder.barcode.scanned Many more | |
| payments | Array | Payments recorded, or to be used in some cases | ||
| header | Object | Slow changing header/overview details about the sale | ||
| customer | Array | |||
| account | Array | |||
| barcodes_scanned | Array | |||
| totals | Object | readonly | A collection of totals and counters about the sale. Use these rather than calculating yourself where possible | |
| delivery_address | Array | |||
| staff | Array | |||
| revision | floating number | readonly | A revision number that increases on each change to the sale object. Technically it contains the date UTC of the change in the format YYYYMMDD.HHmmSSccc | |
| revision_history | Array of changes | readonly | An array of the most recent changes to this sale. Designed to allow consumers to quickly determine what has changed from a previous revision | |
| idk | string | once | Idempotency key used when uploading a complete sale |
flags readonly means that field is not valid (silently ignored) for writing. It is present when reading a sale
Example
{
header: {
phase: active,
startdtu: 20260108.193026
},
lines: [ ],
payments: [],
revision: 20260801.194406
}
header fields
| Field | Datatype | Flags | Description | How to Alter with Salesbuilder |
| phase | string or int | enum | ||
| startdtu | datetime UTC | fd1.salesbuilder.header.setfield | ||
| startdtlocal | datetime local | fd1.salesbuilder.header.setfield | ||
| completedtu | datetime UTC | fd1.salesbuilder.header.setfield | ||
| completedtlocal | datetime local | fd1.salesbuilder.header.setfield |
Notes
- Each field can only be written once
- if local time are supplied the server generates UTC automatically.
- Server will auto manage these if not supplied. You only need to set them if sales aren't "current time"
- If only UTC is supplied, the server attempts to generate local time based on retailer timezone config.
- If no datetimes are supplied, the server allocates current time
- General rule - write local times and leave UTC to server to generate
- If you write both UTC and local time - they must match