Skip to content

Order

A customer's purchase: what was bought, at what price, where it goes, and how far along it is. Lines with quantities and amounts, totals, and three statuses: the order's own, payment and fulfillment.

PackOrders
Versionv1 (latest)
URNurn:postware:orders:order
Identityidentifiers or number
Status categoriesdraft, open, completed, cancelled

Fields

FieldTypeReqNotes
numberstringnothe number the customer sees; unique in the workspace
customerRef<Customer>nothe buyer; absent only when nobody is known, as in a walk-in sale
bill_toAddressnothe billing address as given; defaults from the customer's bill_to
ship_toAddressnowhere the goods go, as given at checkout; defaults from the customer's ship_to
placed_atdatetimenowhen the buyer committed; required once the order leaves draft
expires_atdatetimenofor a quote: when the offer lapses
statusStatus(draft|open|completed|cancelled)yesdraft = a cart or a quote not yet placed; open = placed and in progress; completed = nothing left to do; cancelled; default map[category:open]
payment_statusenum(unpaid|authorized|partially_paid|paid|partially_refunded|refunded|voided)yesdefault unpaid
fulfillment_statusenum(unfulfilled|partial|fulfilled)yesdefault unfulfilled
currencystringyesISO 4217; every Money on the order uses it; pattern ^[A-Z]{3}$
tax_inclusiveboolyesdefault false
linesobject[]yes{key: string, product?: Ref<Product>, price?: Ref<Price>, description: string, sku?: string, quantity: decimal, unit_price: Money, discount?: Money, tax_amount?: Money, amount: Money}
subtotalMoneyyesthe sum of lines.amount
discount_totalMoneynoorder-level discount
shipping_totalMoneyno
tax_totalMoneyno
totalMoneyyes
discount_codesstring[]no
shipping_methodstringnothe delivery option chosen at checkout, as text
aboutRef<any>[]nothe Invoice raised for it, the Deal it came from

Events

order.completed when status.category becomes completed; order.cancelled when status.category becomes cancelled; order.paid when payment_status becomes paid; order.fulfilled when fulfillment_status becomes fulfilled.

Extensions

ExtensionTypeNotes
ext.orders.cancel_reasonstringWhy a cancelled Order was cancelled, in the source's own words.
ext.orders.channelstringWhere the Order was placed: the shop, marketplace or point of sale, as a short stable name (web, pos, amazon).
ext.orders.feesobjectCharges that are neither a line nor shipping: an object { fees: [ { name, amount { amount, currency } } ] } for handling, gift wrap, duties, tips and service charges. They are part of total.
ext.orders.po_numberstringThe buyer's purchase order number on a business order.