Tap On Phone Invocation SDK
The Tap On Phone Invocation SDK enables your application to integrate with ToPP Application
To complete a transaction using this SDK you should follow these steps:
-
Request the ToPP Identifier to ToPP application using this SDK.
-
Use that information along with the transaction related data to request a transaction intent to our services.
-
Send the transaction intent to this SDK to start a transaction flow.
For more details and advanced usage please read all methods documentation defined in this index. Also, please see classes javadoc for more detail
Requirements
Is a requirement to use this SDK to have installed in the device the ToPP application you want to invoque. The ToPP application will be launched by this SDK.
Setup
Add this to your buildScript repositories declaration
Maven repository |
---|
https://nexus.devops.geopagos.com/repository/android-geopagos_public/ |
repositories {
maven { url 'https://nexus.devops.geopagos.com/repository/android-geopagos_public/' }
}
And this to your module dependencies
SDK dependency |
---|
com.geopagos.payments.taponphoneinvocation:topInvocationSdk:$topInvocationSdkVersion |
dependencies {
implementation "com.geopagos.payments.taponphoneinvocation:topInvocationSdk:$topInvocationSdkVersion"
}
Basic use: Initialization
First of all, SDK initialization is required:
TapOnPhoneInvocationSdk.init({CONTEXT}, {APPLICATION_ID})
Where:
-
CONTEXT is the ApplicationContext.
-
APPLICATION_ID is the application ID provided by Geopagos, which may include a suffix to identify different build types.
Basic use: Request Application Data
To get Tap On Phone with PIN Application information you simply have to call:
TapOnPhoneInvocationSdk.requestApplicationData({CALLBACK})
Where:
-
CALLBACK is a function that receives ApplicationDataSdkResult as a parameter with the necessary information to start the transaction.
Note: On first usage if ToPP application is not loaded in memory this callback may have a delay around 5 seconds because of the security checks that are performed on first usage. You may receive a timeout on first usage, if this happen we recommend you to retry the request at least once.
Basic use: Get Session Intent
Once you have the ApplicationDataSdkResult
you should use it to get the Session Intent from Monitor service. If it verifies the app information is correct, it will return 2 Strings (the Session Intent and a hash) required to launch the transaction.
Notes:
-
Any support needed to track issues will require the sessionId linked to the session that arises the issue. Please save this value for further assistance.
-
This endpoint is not public, please contact Geopagos to grant access.
Basic use: Start Transaction
Once you have the Session Intent to start the transaction, you simply need to send it when launching the Tap On Phone Activity, and then handle the result as follows:
val transactionActivityResultLauncher = registerForActivityResult(TapOnPhoneInvocationSdk.getTransactionContract()) { result ->
when (result) {
is TapOnPhoneInvocationSdkResult.Success -> TODO("Handle Transaction Success")
is TapOnPhoneInvocationSdkResult.Error -> {
when (result.error) {
is TapOnPhoneInvocationSdkError.InvalidTransactionIntent -> TODO("Handle InvalidTransactionIntent")
is TapOnPhoneInvocationSdkError.TransactionDenied -> TODO("Handle TransactionDenied")
is TapOnPhoneInvocationSdkError.TransactionAborted -> TODO("Handle TransactionAborted")
is TapOnPhoneInvocationSdkError.ConfigurationError -> TODO("Handle ConfigurationError")
is TapOnPhoneInvocationSdkError.SecurityError.UpdateRequired -> TODO("Handle SecurityError - UpdateRequired")
is TapOnPhoneInvocationSdkError.SecurityError.Other -> TODO("Handle SecurityError - Other")
is TapOnPhoneInvocationSdkError.InternalError -> TODO("Handle InternalError")
is TapOnPhoneInvocationSdkError.NfcNotAvailable -> TODO("Handle NfcNotAvailable")
is TapOnPhoneInvocationSdkError.EULANotAccepted -> TODO("Handle EULANotAccepted")
}
}
}
transactionActivityResultLauncher.launch({SESSION_INTENT})
Where:
-
SESSION_INTENT is an instance of SdkEncryptedSessionIntent, which wraps the Session Intent and it's hash.
Basic use: Release
When you no longer need to use the SDK, you must call
TapOnPhoneInvocationSdk.release()
This will release all resources used by the SDK. All objects retained after release() was called will no longer be valid. You can always init the SDK (as seen previously in this setup guide) to use it again after it was released.