--- title: "Retrieve totals from the terminal" description: "Return payment totals from a terminal and filter for totals by group or operator." url: "https://docs.adyen.com/point-of-sale/reconciling-totals/retrieve-totals-from-the-terminal" source_url: "https://docs.adyen.com/point-of-sale/reconciling-totals/retrieve-totals-from-the-terminal.md" canonical: "https://docs.adyen.com/point-of-sale/reconciling-totals/retrieve-totals-from-the-terminal" last_modified: "2019-08-20T11:48:00+02:00" language: "en" --- # Retrieve totals from the terminal Return payment totals from a terminal and filter for totals by group or operator. [View source](/point-of-sale/reconciling-totals/retrieve-totals-from-the-terminal.md) Using a Terminal API request, your POS app can retrieve totals from a payment terminal without starting a new reconciliation period. The result includes the total value and number of transactions by payment instrument type (such as card) and transaction type (such as credit or debit). You can filter and group the results on aspects like operator or shift number. ## Requirements Before you begin, take into account the following requirements. | Requirement | Description | | -------------------- | --------------------------------------------------------------------------------------------------------- | | **Integration type** | A [Terminal API](/point-of-sale/design-your-integration/terminal-api) integration with payment terminals. | ## Get the totals of a terminal 1. [Log in to the terminal](/point-of-sale/reconciling-totals/log-in-and-log-out). 2. Make a [Terminal API](/point-of-sale/design-your-integration/terminal-api) get totals request, specifying: * The standard [`SaleToPOIRequest.MessageHeader` ](/point-of-sale/design-your-integration/terminal-api#request-message-header)object, with `MessageClass` set to **Service** and `MessageCategory` set to **GetTotals**. | Parameter | Required | Description | | ----------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | | `ProtocolVersion` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **3.0** | | `MessageClass` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Service** | | `MessageCategory` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **GetTotals** | | `MessageType` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Request** | | `ServiceID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal (`POIID`) being used. | | `SaleID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for the POS system component to send this request from. | | `POIID` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The unique ID of the terminal to send this request to. Format: *\[device model]-\[serial number]*. | * The [GetTotalsRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/gettotals) object with: | Parameter | Required | Description | | -------------- | -------- | ---------------------------------------------------------------------------------------------------------- | | `TotalDetails` | | Group the results by terminal (POIID), sale system, operator, shift number, or totals group. | | `TotalFilter` | | Limit the results to the specified terminal (POIID), sale system, operator, shift number, or totals group. | Select the tabs to see some example requests. ### Tab: Totals for a terminal Returns the totals for the specified terminal. #### JSON ```json { "SaleToPOIRequest":{ "MessageHeader":{ "ProtocolVersion":"3.0", "MessageClass":"Service", "MessageCategory":"GetTotals", "MessageType":"Request", "ServiceID":"0518144235", "SaleID":"CashRegB3", "POIID":"P400Plus-275008565" }, "GetTotalsRequest":{ "TotalFilter":{ "POIID":"P400Plus-275008565" } } } } ``` #### Java ```java String serviceID = "YOUR_UNIQUE_ATTEMPT_ID"; String saleID = "YOUR_CASH_REGISTER_ID"; String POIID = "YOUR_TERMINAL_ID"; SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest(); MessageHeader messageHeader = new MessageHeader(); messageHeader.setProtocolVersion("3.0"); messageHeader.setMessageClass( MessageClassType.SERVICE ); messageHeader.setMessageCategory( MessageCategoryType.GET_TOTALS ); messageHeader.setMessageType( MessageType.REQUEST ); messageHeader.setServiceID(serviceID); messageHeader.setSaleID(saleID); messageHeader.setPOIID(POIID); saleToPOIRequest.setMessageHeader(messageHeader); GetTotalsRequest getTotalsRequest = new GetTotalsRequest(); TotalFilter totalFilter = new TotalFilter(); totalFilter.setPOIID(POIID); getTotalsRequest.setTotalFilter(totalFilter); saleToPOIRequest.setGetTotalsRequest(getTotalsRequest); terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest); ``` ### Tab: Totals for a group Returns the totals for a specific group of totals for the specified terminal. #### JSON ```json { "SaleToPOIRequest": { "MessageHeader": { "ProtocolVersion": "3.0", "MessageClass": "Service", "MessageCategory": "GetTotals", "MessageType": "Request", "ServiceID": "0821163913", "SaleID": "CashRegB3", "POIID": "P400Plus-275008565" }, "GetTotalsRequest": { "TotalFilter": { "POIID": "P400Plus-275008565", "TotalsGroupID": "GroupA" } } } } ``` #### Java ```java String serviceID = "YOUR_UNIQUE_ATTEMPT_ID"; String saleID = "YOUR_CASH_REGISTER_ID"; String POIID = "YOUR_TERMINAL_ID"; SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest(); MessageHeader messageHeader = new MessageHeader(); messageHeader.setProtocolVersion("3.0"); messageHeader.setMessageClass( MessageClassType.SERVICE ); messageHeader.setMessageCategory( MessageCategoryType.GET_TOTALS ); messageHeader.setMessageType( MessageType.REQUEST ); messageHeader.setServiceID(serviceID); messageHeader.setSaleID(saleID); messageHeader.setPOIID(POIID); saleToPOIRequest.setMessageHeader(messageHeader); GetTotalsRequest getTotalsRequest = new GetTotalsRequest(); TotalFilter totalFilter = new TotalFilter(); totalFilter.setPOIID(POIID); totalFilter.setTotalsGroupID("GroupA"); getTotalsRequest.setTotalFilter(totalFilter); saleToPOIRequest.setGetTotalsRequest(getTotalsRequest); terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest); ``` ### Tab: Grouped by operator Returns a list of totals for the specified terminal, grouped by operator. #### JSON ```json { "SaleToPOIRequest": { "MessageHeader": { "ProtocolVersion": "3.0", "MessageClass": "Service", "MessageCategory": "GetTotals", "MessageType": "Request", "ServiceID": "0821164804", "SaleID": "CashRegB3", "POIID": "P400Plus-275008565" }, "GetTotalsRequest": { "TotalFilter": { "POIID": "P400Plus-275008565" }, "TotalDetails": [ "OperatorID" ] } } } ``` #### Java ```java String serviceID = "YOUR_UNIQUE_ATTEMPT_ID"; String saleID = "YOUR_CASH_REGISTER_ID"; String POIID = "YOUR_TERMINAL_ID"; SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest(); MessageHeader messageHeader = new MessageHeader(); messageHeader.setProtocolVersion("3.0"); messageHeader.setMessageClass( MessageClassType.SERVICE ); messageHeader.setMessageCategory( MessageCategoryType.GET_TOTALS ); messageHeader.setMessageType( MessageType.REQUEST ); messageHeader.setServiceID(serviceID); messageHeader.setSaleID(saleID); messageHeader.setPOIID(POIID); saleToPOIRequest.setMessageHeader(messageHeader); GetTotalsRequest getTotalsRequest = new GetTotalsRequest(); TotalFilter totalFilter = new TotalFilter(); totalFilter.setPOIID(POIID); getTotalsRequest.setTotalFilter(totalFilter); getTotalsRequest.getTotalDetails().add( TotalDetailsType.OPERATORID ); saleToPOIRequest.setGetTotalsRequest(getTotalsRequest); terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest); ``` 3. In the [GetTotalsResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/gettotals#responses-200-Response), check the `TransactionTotals` object. The following example is the response for a request that asked for the totals of a terminal and group of totals. ```json { "SaleToPOIResponse":{ "MessageHeader":{ "ProtocolVersion":"3.0", "SaleID":"CashRegB3", "MessageClass":"Service", "MessageCategory":"GetTotals", "ServiceID":"0518144235", "POIID":"P400Plus-275008565", "MessageType":"Response" }, "GetTotalsResponse":{ "POIReconciliationID":"1000", "Response":{ "Result":"Success" }, "TransactionTotals":[ { "SaleID":"CashRegB3", "PaymentInstrumentType":"StoredValue", "PaymentCurrency":"EUR", "PaymentTotals":[ { "TransactionType":"Debit", "TransactionCount":1, "TransactionAmount":100.99 } ], "OperatorID":"", "CardBrand":"SVS", "TotalsGroupID":"GroupA", "ShiftNumber":"" }, { "SaleID":"CashRegB3", "PaymentInstrumentType":"Card", "PaymentCurrency":"EUR", "PaymentTotals":[ { "TransactionType":"Debit", "TransactionCount":51, "TransactionAmount":1841.52 } ], "OperatorID":"", "CardBrand":"mc", "TotalsGroupID":"GroupA", "ShiftNumber":"" } ] } } ``` ## See also * [Log in and log out on a terminal](/point-of-sale/reconciling-totals/log-in-and-log-out) * [Reconcile a balance mismatch](/point-of-sale/reconciling-totals/reconcile-a-balance-mismatch)