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