> For the complete documentation index, see [llms.txt](https://wallee.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wallee.gitbook.io/documentation/payments/in-store-payments/integrations/interfaces/android-till-interface.md).

# Android Till SDK

**Android Till Interface:** By using the Android till interface you can directly talk to the terminal software. The benefit is that you can use an Android SDK to interact with the terminal but you can do that only for applications that will run on the terminal. If the application is not running on the terminal the Android till interface does not work. For the [Android Till Interface](https://github.com/wallee-payment/android-till-sdk?tab=readme-ov-file#wallee-android-till-sdk) you will need to add the SDK to your Android app as a dependency.

For testing and publication of your Android app please get in contact with us.

### 1) Add SDK & basics

* Include the Till SDK in your project (see repo README for gradle setup and artifacts).
* Your app runs **on the same terminal** that has the Wallee Payment Application installed. [GitHub](https://github.com/wallee-payment/android-till-sdk?tab=readme-ov-file)

### 2) Create client and bind

```java
public class MainActivity extends AppCompatActivity {
  private ApiClient client;

  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ResponseHandler handler = new ResponseHandler() {
      @Override
      public void authorizeTransactionReply(TransactionResponse resp) {
        // Inspect resp: approved or declined, references, amounts
      }
    };

    client = new ApiClient(handler);
    client.bind(this); // bind to Wallee Till SDK service
  }
}
```

(See repo for full example code.) [GitHub](https://github.com/wallee-payment/android-till-sdk?tab=readme-ov-file)

### 3) Authorize a transaction

```java
Currency currency = Currency.getInstance("CHF");
BigDecimal amount = new BigDecimal("23.60");
List<LineItem> items = new LineItem.ListBuilder("Item A", amount).build();

Transaction trx = new Transaction.Builder(items)
    .setInvoiceReference("IREF-123")
    .setMerchantReference("MREF-123")
    .setCurrency(currency)
    .build();

client.authorizeTransaction(trx);
```

Common operations available on `ApiClient`:

* `checkApiServiceCompatibility()`
* `authorizeTransaction(...)` (purchase/credit/reservation/adjust)
* `completeTransaction(...)` (finish reservation)
* `voidTransaction(...)` (cancel reservation)
* `cancelLastTransactionOperation()`
* settlement ops: `executeSubmission`, `executeTransmission`, `executeFinalBalance`
* utilities: `executeConfiguration`, `executeInitialisation`, `executeGeneratePanToken`, `getPinPadInformation` [GitHub](https://github.com/wallee-payment/android-till-sdk?tab=readme-ov-file)

### 4) Handle responses

Extend `ResponseHandler` to receive:

* `TransactionResponse`, `TransactionCompletionResponse`, `TransactionVoidResponse`
* `SubmissionResult`, `TransmissionResult`, `FinalBalanceResult`
* `GeneratePanTokenResponse`, `GetPinpadInformationResponse`, `GetConfigDataResponse` [GitHub](https://github.com/wallee-payment/android-till-sdk?tab=readme-ov-file)
