triPOS®

Receipt Endpoint

Receipt Endpoint

Use the POST /api/v1/receipt endpoint to print a receipt on a print-capable PIN pad. The posted transaction data will be formatted using either the default template, or a custom template contained in the request, and printed on the PIN pad.

Default Template

Ingenico

If no template is provided in the request's customTemplate field, triPOS will use its Default Receipt Template The default template contains placeholders identified by double beginning and ending curly brackets, e.g., "{{fieldName}}" where fieldName corresponds to the name of a field contained in the request. triPOS replaces the placeholders with the field's value. Furthermore, the template contains custom tags which can be placed along with placeholder, e.g, "@{Center}{{ApplicationLabel}}", triPOS uses to identify and remove data not needed for the receipt based on other field values.

Template Processing Logic

triPOS performs the following steps when replacing the template placeholders with the request data to create the receipt:

  1. Any EMV data sent in the emv field is always displayed.
  2. The receiptType ("Sale", "Refund", "Void", "Authorization") is always displayed to the left of the subTotalAmount.
  3. If both cashbackAmount and tipAmount are not present or 0, no Total is displayed.
  4. If the transaction is declined, the signature, pin verified, and agreement sections of the receipt are not displayed.
  5. If pinVerified is true, the signature section is not displayed.
  6. If emv.Tags are present, the pin verified section is not displayed.
  7. Each string in header and footer string arrays is displayed on a separate line.
  8. The placeholder will be removed for any non-required field not contained in the request.

Custom Template

Ingenico

If the default template isn't adequate, a custom template may be passed into the "customTemplate" field of the request. Use the same placeholders and tag ids contained in the default template so triPOS can properly replace and process them. If no placeholders or ids are used, triPOS will print the custom template as is.

Custom Template Rules(Ingenico Specific)

Ingenico do not support HTML so custom/default template have been used. It has some set of rules:

  1. The three different tags are used for alignment e.g.@{Center},@{Left},@{Right}.
  2. The escape character\r\n is used for line break.
  3. The tag @{Label} is used for key of the placeholder value.
  4. Text formatting can be done with four custom tags @{Bold},@{Reverse},@{DoubleChar},@{BigChar}. This can be apply only on value placeholder not on the @{Label} placeholder.
  5. The tag @{Bold} prefix of value placeholder is used to make text bold. e.g.@{Bold}{{Header}}
  6. The tag @{Reverse} prefix of value placeholder is used to make text background black.
  7. The tag @{DoubleChar} prefix of value placeholder is used to make Double-wide characters.
  8. The tag @{BigChar} prefix of value placeholder to make Very large typeface. Three line feeds must follow a line of these characters to prevent overlap with the next characters or lines.

    To use BigChar we can send the request in <@BigCharOn>{{Header}}<@BigCharOff> this fromat

Note :

    Using both alignment and formatting tags together will make alignment tags to be disabled or unsupported

    Example: @{Center}@{Bold}{{Header}} will make Header bold but the alignment will not be centered

Response

The result of the print operation is return in the printResult field.

Example

POST http://localhost:8080/api/v1/receipt
Body: {
"receiptType": "Sale",
"accountNumber": "xxxxxxxxxxxx1234",
"approvalNumber": "123456",
"totalAmount": "25.00",
"cardLogo": "Visa",
"copyType": "Customer",
"currencyCode": "840",
"entryMode": "Swiped",
"emv": {
"applicationIdentifier": "A0000000031010",
"applicationLabel": "Visa Debit",
"applicationPreferredName": "",
"cryptogram": "AAC 41AF2CF95121D3CA"
},
"hostResponseCode": "00",
"isApproved": "true",
"laneId": "1",
"referenceNumber": "12345678",
"terminalId": "00000000",
"transactionDateTime": "September 3, 2016 2:56 PM ",
"transactionId": "2000986788",
"cashbackAmount": "0",
"tipAmount": "5.00",
"surchargeAmount" : "2:00",
"footer": ["THANK YOU"],
"header": ["Vantiv Integrated Payments", "500 North Juniper Drive", "Suite 100", "Chandler, AZ 85226", "(866) 435-3636"],
"pinVerified": "false",
"subTotalAmount": "20.00"
}

Supported PIN pads