> ## Documentation Index
> Fetch the complete documentation index at: https://adyen-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Reconcile a Balance Mismatch

> Get the totals of a reconciliation period and use them to reconcile balance mismatches between the terminal and POS app.

You may need to reconcile the balance between your payment terminal and POS app when a mismatch occurs. For example, if the connection dropped at some point and your POS app does not receive the final response.

Use the reconciliation request to:

* Get the terminal's totals of the current reconciliation period and start a new period, by setting the reconciliation type to **SaleReconciliation**.

* Get the terminal's report of a previous reconciliation period without starting a new period, by setting the reconciliation type to **PreviousReconciliation** and using `POIReconciliationID` **NNN**.

## Requirements

Before you begin, take into account the following requirements.

| Requirement | Description |
| - | - |
| **Integration type** | A [Terminal API](https://adyen-preview.mintlify.site/point-of-sale/design-your-integration/terminal-api) integration with payment terminals. |

## Make a reconciliation request

1. [Log in to the terminal](https://adyen-preview.mintlify.site/point-of-sale/reconciling-totals/log-in-and-log-out.md).

2. Make a [Terminal API](https://adyen-preview.mintlify.site/point-of-sale/design-your-integration/terminal-api) reconciliation request, specifying:

   * The standard [`SaleToPOIRequest.MessageHeader` ](https://adyen-preview.mintlify.site/point-of-sale/design-your-integration/terminal-api#request-message-header)object, with `MessageClass` set to **Service** and `MessageCategory` set to **Reconciliation**.

     | Parameter | Required | Description |
     | - | - | - |
     | `ProtocolVersion` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **3.0** |
     | `MessageClass` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **Service** |
     | `MessageCategory` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **Reconciliation** |
     | `MessageType` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **Request** |
     | `ServiceID` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | 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-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | Your unique ID for the POS system component to send this request from. |
     | `POIID` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | The unique ID of the terminal to send this request to. Format: *\[device model]-\[serial number]*. The [ReconciliationRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/reconciliation) object with: |

     | Parameter | Required | Description |
     | - | - | - |
     | `ReconciliationType` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | The type of reconciliation: **SaleReconciliation** to get the totals of the current reconciliation period and start a new period. **PreviousReconciliation** to get the report of a previous reconciliation period without starting a new period. Also specify `POIReconciliationID` with a value of **NNN**. |
     | `POIReconciliationID` | | Include this field and set the value to **NNN** when using the reconciliation type **PreviousReconciliation**. |

   #### JSON

   ```json theme={null}
   {
      "SaleToPOIRequest":{
         "MessageHeader":{
            "ProtocolVersion":"3.0",
            "MessageClass":"Service",
            "MessageCategory":"Reconciliation",
            "MessageType":"Request",
            "ServiceID":"0518145303",
            "SaleID":"CashRegB3",
            "POIID":"P400Plus-275008565"
         },
         "ReconciliationRequest":{
            "ReconciliationType":"SaleReconciliation"
         }
      }
   }
   ```

   #### Java

   ```java theme={null}
   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.RECONCILIATION );
   messageHeader.setMessageType( MessageType.REQUEST );
   messageHeader.setServiceID(serviceID);
   messageHeader.setSaleID(saleID);
   messageHeader.setPOIID(POIID);
   saleToPOIRequest.setMessageHeader(messageHeader);

   ReconciliationRequest reconciliationRequest = new ReconciliationRequest();
   reconciliationRequest.setReconciliationType( ReconciliationType.SALE_RECONCILIATION );
   saleToPOIRequest.setReconciliationRequest(reconciliationRequest);
   terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);
   ```

3. In the [ReconciliationResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/reconciliation#responses-200-Response), check the `TransactionTotals` object.

   ```json theme={null}
   {
     "SaleToPOIResponse":{
        "ReconciliationResponse":{
           "ReconciliationType":"SaleReconciliation",
           "POIReconciliationID":"1000",
           "Response":{
              "Result":"Success"
           },
           "TransactionTotals":[
              {
                 "SaleID":"CashRegB3",
                 "PaymentInstrumentType":"Card",
                 "PaymentCurrency":"EUR",
                 "PaymentTotals":[
                    {
                       "TransactionType":"Debit",
                       "TransactionCount":1,
                       "TransactionAmount":10.99
                    }
                 ],
                 "OperatorID":"John",
                 "CardBrand":"mc",
                 "TotalsGroupID":"GroupA",
                 "ShiftNumber":"123"
              }
           ]
        },
        "MessageHeader":{
           "ProtocolVersion":"3.0",
           "SaleID":"CashRegB3",
           "MessageClass":"Service",
           "MessageCategory":"Reconciliation",
           "ServiceID":"0518145303",
           "POIID":"P400Plus-275008565",
           "MessageType":"Response"
        }
     }
   }
   ```

## See also

* [Log in and log out on a terminal](https://adyen-preview.mintlify.site/point-of-sale/reconciling-totals/log-in-and-log-out.md)
* [Retrieve totals from a terminal](https://adyen-preview.mintlify.site/point-of-sale/reconciling-totals/retrieve-totals-from-the-terminal.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.