Skip to content
Last updated

Reports

The Tyro terminal provides a reconciliation report feature: a shorter summary report, or a more comprehensive detail report, for either the current or previous settlement period. Integrated reports let the POS request this report data on demand rather than relying on the terminal's own printer — useful for terminals without a printer attached (consider a PDF printer for saving reports), or POS systems that don't expose Windows printers directly (e.g. those using OPOS).

Requesting reports through the POS also gives access to up to 7 days of reconciliation data, rather than just the current and previous day available directly from the terminal.

  • Reports can be requested at any time of day, and multiple times per day.
  • Reports can only be requested for dates within the last 7 days.

Before you begin, check the certification criteria: Certification Criteria Document.

Making the request

Function definitionPurposeParameters
reconciliationReport(requestParams, responseReceivedCallback)Initiates a reconciliation report request on the terminal.requestParams (Object); responseReceivedCallback — Function (a callback function to provide report data or the relevant error message)
ParameterTypeDescriptionRequired
terminalBusinessDayStringThe reporting date in format yyyyMMdd.Required
typeStringThe report type. Valid values are summary and detail.Required
formatStringThe report format. Valid values are txt and xml. The text version is pre-formatted in a mono-spaced font.Required
midIntegerOverride the configured mid for multi-merchant terminals, or if your browser does not support local storage, or if you have developed headless pairing as a feature.Optional — required for headless pairing, multi-merchant, or if your browser does not support local storage
tidIntegerOverride the configured tid for multi-merchant terminals or if your browser does not support local storage or if you have implemented headless pairing as a feature.Optional — required for headless pairing, multi-merchant, or if your browser does not support local storage
integrationKeyStringSupply the integration key if your browser does not support local storage or if you have developed headless pairing or multi-merchant as a feature.Optional — required for headless pairing, multi-merchant, or if your browser does not support local storage
function doReport(reportDate, reportType, reportFormat) {

  iclient.reconciliationReport({
    terminalBusinessDay: reportDate,
    type: reportType,
    format: reportFormat
  }, reportCallback);
}

var reportCallback = function(response) {
  console.log(JSON.stringify(response));
  $("#result").html(response.result);
  $("#data").html("<pre>" + escapeHtml(response.data) + "</pre>");
  $("#error").html(response.error);
};

JS Fiddle demo

Don't click Save if you make changes in the JS Fiddle — click Run instead. Clicking Save may break the fiddle's functionality.

Handling the response

FunctionDescriptionUsage required
responseReceivedCallbackInvoked when the request has been completed on the terminal. Called with a single object containing the following fields, as shown in the below table.Required
FieldTypeDescriptionUsage required
resultStringThe result of the report request, will be either success or failure.Required
formatStringThe format requested is passed back for convenience, will be either summary or detailed.Optional
typeStringThe type requested is passed back for convenience, will be either txt or xml.Optional
dataStringThe report. Pre-formatted text when format is txt. Parsable XML when format is xml.Required
errorStringAn error message to show the merchant. Only present when result is failure.Required

Steps to follow

  1. The report requested by the POS using reconciliationReport() is returned using responseReceivedCallback — the POS must provide the function required to handle the callback response.
  2. The data field contains the unparsed text or XML version of the report (as per the request); for reference, the format and type for the requested report are also passed back in the format and type fields.
  3. The POS must then parse the report data: for a text format report, remove the labels; for an XML format report, parse the XML to obtain the data for the transactions performed on a given day.

If the request is unsuccessful, the POS will be provided the result and the error message in the result and error fields — display them on the screen for the user's reference.

var reportCallback = function(response) {
  console.log(JSON.stringify(response));
  var report=response.data;
  
  //Parsing the Text version of the report to remove the labels//
  if (($("input[name='format']:checked").val())=="txt"){
  report = report.replace(/NEW_LINE/g," ");
  report = report.replace(/MEDIUM_CENTRED:/g," ");
  report = report.replace(/MEDIUM:/g," ");
  report = report.replace(/MEDIUM_RIGHT:/g," ");
  report = report.replace(/MEDIUM_BOLD:/g," ");
  report = report.replace(/LARGE_CENTRED:/g," ");
  report = report.replace(/FORM_FEED/g," ");
  report = report.replace(/SMALL:/g," ");	
  report = report.replace(/SMALL:/g," ");
  }
     

    console.log(report);

  $("#result").html(response.result);
  $("#data").html("<pre>" + escapeHtml(report) + "</pre>");
  $("#error").html(response.error);
};
Example response

Below is an XML response example for the report request.

{"result":"success",
"format":"xml",
"type":"summary",
"data":"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n
<reconciliation-summary mid=\"200\" tid=\"200\" terminal-business-day=\"2024-01-17\" total=\"1620.00\">\n
<card type=\"visa\" purchases=\"280.00\" refunds=\"-70.00\" total=\"210.00\"/>\n
<card type=\"mastercard\" purchases=\"200.00\" refunds=\"-80.00\" total=\"120.00\"/>\n
<card type=\"eftpos\" purchases=\"1100.00\" cash-out=\"50.00\" refunds=\"0.00\" total=\"1150.00\"/>\n
<card type=\"amex\" purchases=\"30.00\" refunds=\"0.00\" total=\"30.00\"/>\n
<card type=\"diners\" purchases=\"70.00\" refunds=\"0.00\" total=\"70.00\"/>\n
<card type=\"jcb\" purchases=\"40.00\" refunds=\"0.00\" total=\"40.00\"/>\n
</reconciliation-summary>\n"
}