JSON data fields for receipt templates

View the structure of the receipt context JSON object for use in receipt templates.

The receipt context is generated by the buildReceiptContext function and contains all transaction-related information needed for receipt generation.

Base structure

  • All monetary values are represented using the Money type which includes amount (in minor units), currency, and precision.
  • Null values indicate optional or undefined fields.
  • Custom objects can contain arbitrary key-value pairs specific to the implementation.
  • The locale field determines the formatting of dates, times, and numbers in the receipt.

Transaction metadata

FieldTypeDescription
timestampNumberUnix timestamp in milliseconds
timestamp_formattedStringLocalized date/time string based on the locale
order_numberStringUnique transaction reference number
workstation_idStringID of the workstation where the transaction occurred
user_idStringID of the user who processed the transaction
sequence_numberStringSequential transaction number
localeStringLocale code—for example en-US
reprintBooleanIndicates if this is a reprinted receipt
customObjectCustom receipt-level attributes

When referencing these fields in your receipt template, use the exact path to the desired value—for example:

  • {{order_number}}: Transaction reference
  • {{location.location_name}}: Store name
  • {{line_items[0].description}}: First item's description
  • {{payments[0].charge_card.last4}}: Last 4 digits of the first payment card

Customer information

The customer object contains details about the customer associated with the transaction.

Example of a customer objectjson
{
"account_number": string | null,
"salutation": string | null,
"first_name": string | null,
"middle_name": string | null,
"last_name": string | null,
"company": string | null,
"paymentAccounts": string[],
"custom": object
}

Example usage in templates:

  • {{customer.first_name}}: Customer's first name
  • {{customer.account_number}}: Customer's account number
  • {{customer.company}}: Customer's company name

Location information

The location object contains details about the store.

Example of a location objectjson
{
"location_id": string,
"location_name": string,
"description": string | null,
"country": string | null,
"address_line_1": string | null,
"address_line_2": string | null,
"city": string | null,
"state": string | null,
"postal_code": string | null,
"telephone_number": string | null,
"tax_id": string | null
}

Line items

The line_items array contains the items in the transaction. Each line item has the following structure:

Example of a line items arrayjson
{
"item_id": string,
"description": string,
"quantity": number,
"price": {
"amount": number,
"currency": string,
"precision": number
},
"extended_price": {
"amount": number,
"currency": string,
"precision": number
},
"tax_code": string,
"price_modifiers": [
{
"description": string,
"amount": {
"amount": number,
"currency": string,
"precision": number
}
}
],
"attributes": [
{
"label": string,
"value": string
}
],
"facets": [
{
"name": string,
"value": string | null
}
],
"custom": object
}

Transaction totals

FieldTypeDescription
subtotalMoneyTransaction subtotal before tax
taxMoneyTotal tax amount
totalMoneyTransaction total including tax
subtotal_grossMoneySubtotal including cart-level discounts
tax_idStringTax identification number

Money objects have the following structure:

Attributes of a Money objectjson
{
"amount": number,
"currency": string,
"precision": number
}

Tax summary

The tax_summary array contains tax calculations per tax code:

Example of tax summary arrayjson
{
"code": string,
"total_net": Money,
"total_gross": Money,
"tax_rate": string,
"total_tax": Money
}

Payments and refunds

Both payments and refunds arrays contain tender entries with the following base structure:

Example of a tender entry for a payment or refund arrayjson
{
"type": string,
"amount": Money,
"custom": object | null
}

These can contain the following additional fields based on tender type:

Credit card

Example of credit card fieldsjson
{
"charge_card": {
"processor": string,
"processor_id": string,
"last4": string,
"brand": string,
"account_type": string,
"application_preferred_name": string | null,
"dedicated_file_name": string | null,
"authorization_response_code": string,
"application_cryptogram": string | null,
"terminal_verification_results": string | null,
"transaction_status_information": string | null
}
}

Voucher or return card

Example of voucher or return card fieldsjson
{
"voucher": {
"number": string,
"last4": string,
"type": string,
"balance": Money
}
}

Cart information

The carts array contains sub-transactions, such as returns or exchanges, within the main transaction:

Example of a carts arrayjson
{
"type": string,
"id": string,
"line_items": Array<LineItem>,
"total": Money,
"gift_receipt": boolean,
"custom": object | null
}

Gift receipt items

The giftable_items array contains items eligible for gift receipts:

Example of a giftable_items arrayjson
{
"item_id": string,
"description": string,
"brand": string | null,
"color": string | null,
"gift_receipt": boolean,
"custom": object | null
}

Cart-level discounts

The cart_discounts array contains transaction-level discounts:

Example of a cart_discounts arrayjson
{
"description": string,
"amount": Money
}