Sales receipt template

Use this sample template to create sales receipts. It demonstrates formatting, conditional sections, and data placeholders used by the receipt rendering service.

You can preview and adapt this template in the InStore Center. Create a Receipt Template set that includes this template, then open it for editing.

Receipt template source

The numbered lines help you map each instruction to the reference table below. Keep the numbering only while learning or documenting; remove it before deploying if your workflow requires an unnumbered template.

Template

1. `{{logo 32 32}}`
2. `{align:center}`
3. `{{location.description}}`
4. `{{location.address_line_1}}{{#if location.address_line_2}}\n{{location.address_line_2}}{{/if}}`
5. `{{location.city}}`
6. `{{location.state}}`
7. `{{location.postal_code}}`
8. `{{location.telephone_number}}`
9. `{{if reprint}}`
10. `{align:center}`
11.
12. `^^^**_Reprinted Receipt_**`
13.
14. `{{/if}}`
15. `{align:left}`
16. `|Date: |{{timestamp_formatted}}`
17. `|Workstation pipe: |{{session.workstation_id}}`
18. `|Cashier: |{{user_id}}`
19. `|VAT ID: |{{tax_id}}`
20. `|Transaction #: |{{order_number}}`
21. `{align:center}`
22.
23. `{{barcode order_number}}`
24.
25. `{{#each line_items}}`
26. `{width:30,12,_; align:left}`
27. `|{{truncate description 28}} | {{formatCurrency extended_price}}| {{truncate tax_code 3}}`
28. `{width:16,20,4; align:right}`
29. `{{#if quantity}}{{quantity}}{{else}}1{{/if}} @ {{formatCurrency price}}`
30. `{{#each price_modifiers}}`
31. `| {{description}} | ({{formatCurrency amount}})|`
32. `{{/each}}`
33. `{width:16,20,4; align:right}`
34. `{{#each attributes}}`
35. `| {{label}}: | {{value}}|`
36. `{{/each}}`
37. `{{/each}}`
38. `{width:\_; align:center}`
39. `---`
40. `{width:20,\*; align:left}`
41. `^^^Total: | ^^^{{formatCurrency total}}`
42.
43. `{width:20,_; align:right}`
44. `{{#each payments}}`
45. `|^{{type}}: | {{formatCurrency amount}}`
46. `{{#if cash}}
47. `|Cash Rounding: | {{formatCurrency cash.roundedRemainder align:right}}
48. `{{/if}}
49. `{{#if charge_card}}`
50. `{{#if charge_card.additional_data}}`
51. `{{#if charge_card.additional_data.receiptData}}`
52. `{width:16,20; align:right}`
53. `|Card: | {{charge_card.additional_data.receiptData.pan}}`
54. `|PAN seq: | {{charge_card.additional_data.receiptData.panSeq}}`
55. `|Pref. name: | {{charge_card.additional_data.receiptData.preferredName}}`
56. `|Card type: | {{charge_card.additional_data.receiptData.cardType}}`
57. `|Payment method: | {{charge_card.additional_data.receiptData.paymentMethod}}`
58. `|Payment variant: | {{charge_card.additional_data.receiptData.paymentMethodVariant}}`
59. `|Entry mode: | {{charge_card.additional_data.receiptData.posEntryMode}}`
60. `|AID: | {{charge_card.additional_data.receiptData.aid}}`
61. `|MID: | {{charge_card.additional_data.receiptData.mid}}`
62. `|TID: | {{charge_card.additional_data.receiptData.tid}}`
63. `|PTID: | {{charge_card.additional_data.receiptData.ptid}}`
64. `|Auth. code: | {{charge_card.additional_data.receiptData.authCode}}`
65. `|Response code: | {{charge_card.authorization_response_code}}`
66. `|Tender: | {{charge_card.additional_data.receiptData.txRef}}`
67. `|Reference: | {{charge_card.additional_data.receiptData.mref}}`
68. `|Type: | {{charge_card.additional_data.receiptData.txtype}}`
69. `|^TOTAL: | {{formatCurrency charge_card.additional_data.receiptData.totalAmount}}`
70. `{{/if}}{{else}}`
71. `{width:24,20; align:right}`
72. `|card number: | {{charge_card.last4}}`
73. `|account type: | {{charge_card.brand}}/{{charge_card.account_type}}`
74. `|application name: | {{charge_card.application_preferred_name}}`
75. `|AID: | {{charge_card.dedicated_file_name}}`
76. `|ARC: | {{authorization_response_code}}`
77. `{{/if}}{{/if}}`
78. `{{#if gift_card}}`
79. `{width:16,20; align:right}`
80. `|card number: | _{{gift_card.last4}}`
81. `|card type: | {{gift_card.type}}`
82. `{{/if}}`
83. `{{#if voucher}}`
84. `{width:16,20; align:right}`
85. `|Voucher number:|{{voucher.number}}`
86. `{align:center}`
87. `{{barcode voucher.number}}`
88. `{{/if}}`
89. `{{#if wallet}}`
90. `{width:16,20; align:right}`
91. `method: {{wallet.method}}`
92. `|transaction id: | {{wallet.transaction_id}}`
93. `|merchant id: | {{wallet.merchant_id}}`
94. `|terminal id: | {{wallet.terminal_id}}`
95. `{{/if}}`
96. `{{/each}}`
97. `{width:_; align:center}`
98. `^VAT Summary`
99. `{width:10,12,12,\_}`
100. `Code | Rate| Net| VAT`
101. `{{#each tax_summary}}`
102. `{{code}} | {{tax_rate}}| {{formatCurrency total_net}}| {{formatCurrency total_tax}}`
103. `{{/each}}`
104. `---`
105. `{{#if reprint}}`
106. `{width:\*; align:center}`
107. `^^^**_ Reprinted Receipt _**`
108.
109. `{{/if}}`
110. `{width:\*; align:center}`
111. `^^Thank you! Come again!`

Line reference

Location and address data is pulled from fields on the Location Information page in the InStore Center.
Line numberSource and description of field
1Inserts the logo image stored in printer memory at position 32 32 (not rendered in SVG preview). See printer manufacturer documentation for logo support.
2Centers the following text.
3Inserts the location name (Location Name field).
4Inserts Address Line 1. Adds Address Line 2 on a new line if present.
5Inserts the city or town.
6Inserts the state, province, or county.
7Inserts the postal code.
8Inserts the telephone number.
9Starts a conditional block that renders only for a reprinted receipt (reprint is true).
10Centers the reprint heading.
11Blank line (line feed).
12Inserts a reprint banner with level-three emphasis markers (^^^) and bold/italic formatting markers.
13Blank line (line feed).
14Ends the reprint conditional block.
15Left-aligns subsequent label/value lines.
16Starts a two-column table: left column labels, right column dynamic values. Inserts timestamp_formatted from the server using server-defined formatting.
17Inserts the workstation identifier (session.workstation_id).
18Inserts the cashier user identifier.
19Inserts the Tax ID from Environment > General unless overridden on the Location Information page.
20Inserts the transaction order_number (also visible on the Search Transactions page).
21Centers the barcode section.
22Blank line (line feed).
23Renders a barcode for order_number.
24Blank line (line feed).
25Begins iteration over line_items.
26Defines a three-column layout (30 / 12 / remaining width) left-aligned for the next line item table row.
27Inserts truncated description (28 chars), extended_price in currency format, and truncated tax code (3 chars).
28Redefines column widths (16 / 20 / 4) and right-aligns subsequent values.
29Inserts quantity (or 1 if missing) and per-unit price.
30Begins iteration over price_modifiers (discounts / adjustments).
31Inserts each discount description and discount amount in currency format.
32Ends price_modifiers iteration.
33Redefines column widths (16 / 20 / 4) for attributes section.
34Starts a subsection and specifies that each of the attributes (defined in the Composable Commerce Project) listed will be formatted as follows.
35Inserts a table displaying the attribute label: and value of each line-item attribute (for example, color: Black).
36Ends the subsection that formats attributes.
37Ends the subsection that formats line_items.
38Defines the width of and center-aligns the following line.
39Inserts a ruled line.
40Defines the width of each column in the next table level to be created and aligns the text to the left. Column 1 is 20 characters wide and column 2 uses the remaining space.
41Inserts the label Total: (level-three emphasis) and the cart total in currency format.
42Blank line, which renders as white space (linefeed) on the receipt.
43Defines the width of each column in the next table level to be created and aligns the text to the right. Column 1 is 20 characters wide and column 2 uses the remaining space.
44Starts a subsection and specifies that each of the tenders used in the transaction will be formatted as follows.
45Creates a table displaying the payment type (emphasized) and tender amount in currency format (for example, Cash: 137.08).
46For use in templates in cash-rounding locales only. Sets a condition for data within the if tags; include only if this is a cash transaction.
47For use in templates in cash-rounding locales only. Creates a table displaying the label “Cash Rounding:” and the rounded remainder in currency format.
48For use in templates in cash-rounding locales only. Ends the if condition for a cash transaction.
49Sets a condition that the following formatting will be used if one of the tenders listed is a charge_card, which is a credit or debit card.
50Sets a condition that the following formatting is used if there is additional.information available about the charge_card.
51Sets a condition that the following formatting will be used if there is a receipt.data package returned by the payment service provider (PSP) for the charge_card.
52Defines the width of each column in the next table level to be created and aligns the text to the right. Column 1 is 16 characters wide and column 2 is 20 characters wide.
53-69Inserts a table displaying data returned in the PSP receipt.data package (contact your PSP for field definitions).
70Ends the receipt.data block; begins an else block for charge_card without PSP receipt.data.
71Defines the width of each column in the next table level to be created and aligns the text to the right. Column 1 is 24 characters wide and column 2 is 20 characters wide.
72-76Inserts a table displaying card detail data returned for the charge_card.
77Ends the subsections that format the additional.information and charge_card conditions.
78Sets a condition that the following formatting is used if the transaction contains a tender type of gift_card.
79Defines the width of each column in the next table level to be created and aligns the text to the right. Column 1 is 16 characters wide and column 2 is 20 characters wide.
80-81Inserts a table that displays the gift_card.last4 (obtained from the user who swiped, scanned, or typed the gift card), and the gift_card.type (returned by the gift card processor).
82Ends the subsection that formats gift_card information.
83Sets a condition that the following formatting is used if the transaction contains a tender type of voucher.
84Defines the width of each column in the next table level to be created and aligns the text to the right. Column 1 is 16 characters wide and column 2 is 20 characters wide.
85Inserts a table displaying the label “Voucher number:” and the voucher.number value.
86Aligns the following text to the center of the page.
87Renders a barcode representation for the voucher.number.
88Ends the condition for the voucher tender type.
89Sets a condition that the following formatting will be used if the transaction contains a tender type of wallet.
90Defines the width of each column in the next table level to be created and aligns the text to the right. Column 1 is 16 characters wide and column 2 is 20 characters wide.
91Inserts the wallet.method used (for example, tap, swipe, insert).
92-94Inserts a table displaying wallet processor data.
95Ends the subsection that formats the wallet information.
96Ends the section that formats the tenders information.
97Defines the width of the following lines and aligns them to the center.
98Inserts a plain-text label of VAT Summary and gives it level one emphasis. This label announces the tax section of the receipt. Change the VAT Summary title to the type of tax summary applicable to your locale.
99Defines the width of each column in the next table level to be created. Column 1 is 10 characters wide, column 2 is 12 characters wide, column 3 is 12 characters wide, and column 4 uses the remaining space.
100Inserts a table with column headers: Code (tax service code), Rate (set up within the tax service), Net (total cart net), VAT (total tax as calculated by the tax service).
101Starts a subsection and specifies that each tax_summary (taxation code) listed will be formatted as follows.
102Inserts the code, tax_rate, total_net, and total_tax values in the correct column, creating a row for each tax code found.
103Ends the subsection about tax_summary.
104Blank line, which renders as white space (linefeed) on the receipt.
105Sets a condition for data within the if tags; include it only if this is a reprinted receipt.
106Aligns the following text to the center of the page.
107Specifies the text that prints only when the if condition is met; uses carets for level three emphasis and double asterisks for italics.
108Blank line, which renders as white space (linefeed) on the receipt.
109Ends the "if" condition for reprinted receipts.
110Defines the width of the lines that follow and center-aligns them.
111Displays the plain-text label: Thank you! Come again!
You don't need a cutfeed directive, as ReceiptLine automatically adds this when it reaches the end of the template.