Android TTA

This Android TTA is suitable for pulling in as an embedded library for Android-based POS's. The goal is to provide a similar / identical API to what Tyro iOS-TTA provides.

Please download the below Android TTA solution.

Android TTA

Before you begin the development work, please have a look at the certification criteria, which provide a checklist of the minimum requirements for this certification with Tyro.

Certification Criteria Document

Usage

Tyro Android TTA is written in Kotlin that can be embedded in Android apps. The TyroClient wraps the iclient via an embedded WebView under the POS's control.

API Definitions

  • Embedded wrapper library is defined as “package com.tyro.androidtta”.
  • Examples of how to handle receipt call-backs, request context, transaction complete call-backs can be found in the library as well.

Setting iClient Source

Defining where the wrapper finds the iClient Javascript library location (Simulator, Test and Production) can be located in com.tyro.androiddtta > iclientSource from here you can use a mutli-endpoint array (below) or singular if you are only using the one endpoint.

Copy
Copied
public enum IclientSource {
  PRODUCTION("https://iclient.tyro.com"),
  TEST("https://iclient.test.tyro.com"),
  SIMULATOR("https://iclientsimulator.test.tyro.com");
  private String url;
  IclientSource(String url) {
  this.url = url;
  }
  public String getUrl() {
  return url;
  }
}

Setting API key, POS Data and iClient URL for transactions

Copy
Copied
tyroClient = TyroClient(webView,
 "someApiKey", //no API key is needed for test or simulated transactions, a real API key will be needed for production transactions
 PosProductData("DOMENIC’S POS COMPANY", "POS NAME", "1.1.0"),
 IclientSource.TEST

Headless Pairing (Custom Pairing)

Android's WebView component is based on Chromium. Chromium made modifications to the way third-party cookies are handled in order to increase security and privacy while giving users greater control and transparency. When apps target Android 12 (API level 31) or higher, these modifications are also included in WebView as of Android 12. Due to these changes with the WebView, the pairing details will not be persistent when you process a transaction if the Tyro pairing UI (https://iclientsimulator.test.tyro.com/configuration.html#expert) is loaded up in a WebView to complete the pairing process. Because of the above mentioned changes, it is mandatory for our POS partners to implement the pairing feature using our pairing API (Headless Pairing).

Sample Code Example 01

Copy
Copied
PairingButton.setOnClickListener
{
val parameters = mutableMapOf<String,Any>()
val mid = MID.text.toString()
val tid = TID.text.toString()
parameters["mid"] = "$mid"
parameters["tid"] ="$tid"
tyroClient.performOperation(
"pairTerminal",
 parameters,
{receipt -> },
{data -> println("data = [$data]")})
}

Android Studio Logcat Output:

Copy
Copied
2024-02-21 11:20:53.688 28181-28437 System.out  com.tyro.tyroclientsample  I  data = [{message=Pairing successful., status=success, integrationKey=b34fe79127d0d70b07563a94622366a8}]

Sample Code Example 02

Copy
Copied
PairingButton.setOnClickListener {
    display.text = "\n\n\tStatus:\n\tinProgress\n\n\tMessage:\n\tPlease perform the \"Authorise POS\" function on your terminal"
    val parameters = mutableMapOf<String, Any>()
    val mid = MID.text.toString()
    val tid = TID.text.toString()
    parameters["mid"] = mid
    parameters["tid"] = tid
    tyroClient.performOperation(
        "pairTerminal",
        parameters,
        { receipt -> },
        { data ->
            if (data["status"] == "success") {
                display.text= "\n\n\tStatus:\n\t" + "${data["status"]}\n\n" + "\tMessage:\n\t" +
                            "${data["message"]}\n\n" + "\tIntegration Key:\n" + "\t${data["integrationKey"]}"
            }
            else
               {display.text= "\n\n\tStatus:\n\t" + "${data["status"]}\n\n" + "\tMessage:\n\t" +
                            "${data["message"]}\n\n" + "\tIntegration Key:\n" + "\t${data["integrationKey"]}"}
        }
    )
}
important

The POS must display the "status" and "message" fields on the POS UI gracefully. The POS must store the MID number, TID number, and integration key in the database of their POS app and pass them when processing a transaction.

Copyright © Tyro Payments 2019-2022. All right reserved.