FD1 Client Protocol

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

FieldDatatypeFlagsDescriptionHow to Alter with Salesbuilder
linesArrayItems being purchased or returned.fd1.salesbuilder.product.add
fd1.salesbuilder.barcode.scanned
Many more
paymentsArrayPayments recorded, or to be used in some cases
headerObjectSlow changing header/overview details about the sale
customerArray
accountArray
barcodes_scannedArray
totalsObjectreadonlyA collection of totals and counters about the sale. Use these rather than calculating yourself where possible
delivery_addressArray
staffArray
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
idkstringonceIdempotency 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

FieldDatatypeFlagsDescriptionHow to Alter with Salesbuilder
phasestring or intenum
startdtudatetime UTCfd1.salesbuilder.header.setfield
startdtlocaldatetime localfd1.salesbuilder.header.setfield
completedtudatetime UTCfd1.salesbuilder.header.setfield
completedtlocaldatetime localfd1.salesbuilder.header.setfield

Notes

start and complete datetimes
  • 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