Give customers the option of receiving paperless receipts by delivering them via email or text message.
InStore supports the option at checkout to send a paperless receipt to a customer via email, short-message service (SMS), or text. You must configure this option by sending a receipt template, such as your existing Sales Receipt, and cart data to the Receipt Print Server API.
To control whether a customer can enter their email address or phone number on an ad-hoc basis, use the
Allow_Defaulted_Customer_Email_Override
and Allow_Defaulted_Customer_Phone_Override
administration parameters .To learn how to listen for the customer's selection at the checkout, see the inStoreCore_receiptChoices event.
Generate a Scalable Vector Graphic (SVG) receipt
The
svg
endpoint lets you generate an SVG representation of a receipt without actually printing it. This is the SVG that is displayed on-screen at checkout and when reprinting the receipt. The builder utility processes the template and data of receipts. This builder utility converts currency values to Dinero format to ensure proper formatting, and is useful for previewing receipts or generating digital images of receipts.Request
Send a POST request with the following fields to the InStore colleague app's Receipt Print Server API:
POST /api/svg
{
"template": "Receipt template markup using Handlebars syntax",
"data": "JSON data object with receipt information",
"currency": "USD",
"locale": "en-US",
"currencyFormat": "Currency format string or object"
}
For example:
{
"template": "^{{location.location_name}}^\n{{location.address_line_1}}\n-----------------\n{{#each line_items}}\n{{description}} {{quantity}} @ {{price}}\n{{/each}}\n-----------------\nTotal: {{total}}",
"data": {
"location": {
"location_name": "COFFEE SHOP",
"address_line_1": "123 Main Street"
},
"line_items": [
{
"description": "Cappuccino",
"quantity": 1,
"price": "$4.50"
},
{
"description": "Croissant",
"quantity": 2,
"price": "$3.75"
}
],
"total": "$12.00"
},
"currency": "USD",
"locale": "en-US",
"currencyFormat": "$0,0.00"
}
Response
The server returns the status and receipt markdown that you can use to populate your own HTML template, which is suitable for sending from your outbound email or SMS system.
{
"markdown": "Compiled receipt markdown",
"svg": "SVG representation of the receipt",
"success": true
}
For example:
{
"markdown": "^COFFEE SHOP^\n123 Main Street\n-----------------\nCappuccino 1 @ $4.50\nCroissant 2 @ $3.75\n-----------------\nTotal: $12.00",
"svg": "<svg width=\"576px\" height=\"210px\" viewBox=\"0 0 576 210\" preserveAspectRatio=\"xMinYMin meet\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" version=\"1.1\"><style type=\"text/css\"><![CDATA[@import url(\"https://fonts.googleapis.com/css2?family=Courier+Prime&display=swap\");]]></style><defs><filter id=\"receiptlineinvert\" x=\"0\" y=\"0\" width=\"100%\" height=\"100%\"><feFlood flood-color=\"#000\"/><feComposite in=\"SourceGraphic\" operator=\"xor\"/></filter></defs><g font-family=\"'Courier Prime', 'Courier New', 'Courier', monospace\" fill=\"#000\" font-size=\"22\" dominant-baseline=\"text-after-edge\" text-anchor=\"middle\"><g transform=\"translate(0,24)\"><text transform=\"scale(2,1)\"><tspan x=\"84\">C</tspan><tspan x=\"96\">O</tspan><tspan x=\"108\">F</tspan><tspan x=\"120\">F</tspan><tspan x=\"132\">E</tspan><tspan x=\"144\">E</tspan><tspan x=\"156\"> </tspan><tspan x=\"168\">S</tspan><tspan x=\"180\">H</tspan><tspan x=\"192\">O</tspan><tspan x=\"204\">P</tspan></text></g><g transform=\"translate(0,54)\"><text><tspan x=\"204\">1</tspan><tspan x=\"216\">2</tspan><tspan x=\"228\">3</tspan><tspan x=\"240\"> </tspan><tspan x=\"252\">M</tspan><tspan x=\"264\">a</tspan><tspan x=\"276\">i</tspan><tspan x=\"288\">n</tspan><tspan x=\"300\"> </tspan><tspan x=\"312\">S</tspan><tspan x=\"324\">t</tspan><tspan x=\"336\">r</tspan><tspan x=\"348\">e</tspan><tspan x=\"360\">e</tspan><tspan x=\"372\">t</tspan></text></g><!-- SVG truncated for brevity -->",
"success": true
}
The
^
characters in the template are used for styling (typically bold or larger text) and the template uses Handlebars syntax for dynamic content. For more information, see Receipt data.