In-App SDK Integration
Version History
Date | Version | Details |
---|---|---|
21/01/23 | 1.7.0 | Initial version |
16/06/23 | 1.7.4.1 | Fixes |
22/12/23 | 1.7.4.7 | Fixes |
High-level Integration flow
The following is a high-level overview to enable Tap on Phone on a merchant device, the App uses the iPOSgo SDK to initialize a ToPService and access its features.
- The App creates an instance object of ToPService class and calls the topService.registerDevice() method of the iPOSgo sdk. The request includes registration details such as the TPN, Merchant code and registration listener. The registerDevice() method will sends the registration payload to the iPOSgo backend system to authenticate the device.
- On successful of device registration, sdk will returns onRegisterListener.OnRegisterSuccess() method with json object(message, session key, server key, session created timestamp and session expiry in seconds.) else it will return onRegisterListener.onRegisterError() method with error code and message( Invalid TPN, Invalid Access code, Invalid device etc.,)
- The App stores the successful response in the App SharedPreference or database to validate on transaction time.
- On every new transaction App should check the session data.
- Get the session key and expiry from App database and validate it.
- If device session key is not expired, then call API methods of the iPOSgo sdk.
- If API request and response is successful, sdk will returns respective listener object which contains success or error data.
- The App stores the success or response in the App database or backend system.
Prerequisites
For Sandbox (UAT) Users should be onboarded on iPOSpays sandbox(UAT) environment as a merchant and have a valid TPN.
For Production (Live) Users should be onboarded on iPOSpays production environment as a merchant and have a valid TPN.
If you do not have a TPN, contact your ISO or support@dejavoo.io.
Steps to Access the TOP SDK or API Keys
Step 1: Log in to the iPOSpays portal. Step 2: Generate Ecom/TOP Merchant Keys:
-
Navigate to Menu → Settings → Generate Ecom/TOP Merchant Keys.
-
Select the TPN.
-
Click Generate. Step 3: Access TOP SDK APIs:
- Use the TPN and Merchant Code to access the following APIs:
- Device Register
- Perform Transaction
- Tip Adjustment
- Batch Settlement
- Reports
- Use the TPN and Merchant Code to access the following APIs:
-
Step 4: Access Void, Refund, and Batch Settlement APIs:
- Use the TPN and Auth Token for these APIs.
-
Step 5: Implement Direct Void, Refund, and Batch Settlement APIs:
- Navigate to Menu → Developer Central → iPOS Transact → API Document for detailed instructions.
Installation Setup
Step 1: Install Android Studio IDE
Download Android Studio fromhttps://developer.android.com/studio (opens in a new tab)
Step 2: Ensure Compatibility:
Supported Devices & Versions:
- Devices running Android OS 8.1 or later.
- Devices with NFC compatibility.
Step 3: Configure Your Project:
- Add the SDK libraries (*.aar) to the “libs” folder of your existing Android project.
- Example:
SoftPos-v1.3.66.7-Debug_Test.aar.
- Example:
- If your project does not already have a “libs” folder:
- Create one by right-clicking on the project, selecting “New”, and then choosing “Folder”.
Step 4: Update gradle.properties:
- Add the following line in the gradle.properties file (located in the root folder of your project) to support legacy features in the SDK:
android.enableJetifier = true
To obtain the library file containing the access key and secret key required for integration, please Contact devsupport@denovosystem.com. Make sure to CC your Dejavoo representative when sending your request.
Add below lines in build.gradle of your project
dependencies{
implementation'com.denovo:topliteapp:1.7.5.0'
implementationfiles('libs/SoftPos-v1.3.66.7-Debug_Test.aar')
}
Permissions
The Prerequisite permissions which need to be used in manifest file
Add the following line tool:replace inside the application tag, which will avoid the manifest merge errors
<application>
android:name="YOUR_APPLICATION_CLASS"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
...
tool:replace="android:allowBackup,android:roundIcon,android:theme">
activity
</application>
Refer the image attachment
- Proguard-rules.pro
Add below lines in proguard-rules.pro of your project
-keepattributes Signature
-keep class sun.misc.* { *; }
-keepattributes Exceptions, Signature, InnerClasses
-keep class com.google.gson.stream.** { *; }
-keep class com.cardtek.softpos.**{*;}
-keep class vhbgotabuuowoix.**{*;}
-keep class com.denovo.app.top.**{*};
- Add Paycore library into the project
Add the paycore library in the integrator app as shown in the below images
Ask Location Run-Time Permission Dialog
Add the Location run-time permission on your application level, like shown below
Device Register API
This API is used on every new install of App, cache clear, data clear of your application, check whether session data are available or not. If not, then call the register device API. To do create an instance of Top Service class and call the register device() method to invoke device registration process. Please do flow the below flowchart diagram.
Request Parameters
Field | Type | Description | Example |
---|---|---|---|
TPN * | string | It’s a Unique 12digit code. This value is unique for each merchant. | 123456789012 |
Merchant Code * | string | A unique code is generated and assigned to each merchant | 210987654321 |
registrationListener * | string | Create an instance object & pass the object or create Anonymous callback to receive response. | OnRegistrationListener registrationListener = new OnRegistrationListener (); or new OnRegistrationListener ({//@override methods}); |
Response Parameters
Field | Type | Description | Example |
---|---|---|---|
message * | string | Status message is shown when session key generated successfully. | Registration done successfully |
session_key * | string | Session Key is used to access the sub sequent of iPOSgo sdk API’s. So, this key must be maintained across the application. | ff8c2759-ba8e-4abe-a4a7-9f6d116194e9 |
auth_token * | string | Auth Token is used to interact with iPOSgo backend system to do the void, batch settlement, etc., | API access Token |
session_created_timestamp * | string | Session Key created timestamp in milliseconds is used to validate the session key expiry | 1672038767 |
session_expiry_in_ millseconds * | string | This will indicate that the session key expiry time in milliseconds. Default expiry is 24hrs. | 86400000 |
Snippet Code
ToPServicetopService=newToPService(Activityactivity);//showprogressdialogheretopService.registerDevice(tpn,
merchantCode,
newToPService.onRegistrationListener(overridepublicvoidonRegisterSuccess(JSONObjectsuccessObject){
//dismissprogressdialoghere//samplesuccessresponse{
“message”: “Registrationdonesuccessfully”,
“session_key”: “xxxxxxxxxxxxxxxxxxxxxx”,
“auth_token”: “xxxxxxxxxxxxxxxxxxxxxx”,
“session_created_timestamp”: ”1672038767”“session_expire_time”: “86400”
}
}publicvoidonRegisterError(JSONObjecterrorObject){
//dismissprogressdialoghere//sampleerrorresponse{
“error_code”: “403”,
“error_message”: “InvalidTPN”
}
}@overridePublicvoidonProcess(Stringmessage){
//updateprogressdialogmessagehere
}
});
Perform Transaction API
This api is used to accept a contactless EMV transactions. Calling this API will trigger the SDK to enable NFC for a contactless communication between the payment card and device. On successful card read, SDK will send and process transaction.
To perform the transaction API app needs to pass a JSON object(contains amount, type), Session key, custom object(HashMap), transaction listener as input parameters. we will get the response on asynchronous transaction listener methods.
Request Parameters
Field | Type | Description | Example |
---|---|---|---|
inputObject * | string | Pass the raw JSON data | { “type”: “SALE”,“amount”: “20.00” } Or { “type”: “REFUND”,“amount”: “20.00” }Or{ “type”: “VOID” } |
sessionKey * | string | Pass the Session key which received on successful registration. | ff8c2759-ba8e-4abe-a4a7-9f6d116194e9 |
onTransactionListener * | string | Create an instance object & pass the object or create Anonymous callback to receive response. | new onTransactionListener();or new onTransactionListener({}); |
Response Parameters
Field | Type | Description | Example |
---|---|---|---|
onTransactionSuccess * | string | On successful transaction, it returns response as JSON data which have all the transaction details. | { “status”: “Approved” “last_4_digits”: “1234”, “transaction_title”: “SALE”, “transaction_type”: “1”, “transaction_mode”: “1”, “transaction_id”: “000001”, “invoice_no”: “000002”, “amount_paid”: “20.00”, “card_type”: “MASTERCARD”, “mask_pan”: “**************5678”, “date”: “2022-07-06”, “time”: “13:05:22”,} |
onTransactionError * | string | If transaction get any error, it returns the response as JSON data which have the appropriate error message. | { “status”: “declined”, “message”: “Card limit exceeds”} |
Snippet Code
ToPService topService = new ToPService(Activity activity);
topService.performTransaction(inputObject, sessionKey, new ToPService.OnTransactionListener)
@Override
public void onTransactionSuccess (JSONObject successObject){
// sample success response
{
“status”: “Approved”,
“last_4_digits”: “1234”,
“transaction_title”: “SALE”,
“transaction_type”: “1”,
“transaction_mode”: “1”,
“transaction_id”: “000001”,
“invoice_no”: “000002”,
“amount_paid”: “20.00”,
“card_type”: “MASTERCARD”,
“mask_pan”: “**************5678”,
“date”: “2022-07-06”,
“time”: “13:05:22”,
}
}
@override
public void onTransactionError (JSONObject errorObject) {
// sample error response
{
“status”: “declined”,
“message”: “Card limit exceeds”
}
}
@override
Public void onRegisterNeeded(JSONObject errorObject){
//sample error response
{
“error_code”:”960”,
“message”:”Session key is expired,To authenticate,please re-intiate device registration api”
}
};
Batch Settlement API
A batch is a group of transactions that have been processed but have yet to be settled. When a transaction is approved, it is added to the batch. When a batch hasn’t been settled yet, it is called an open batch, and transactions in the batch can still be voided and reversed if needed.
Request Parameters
Field | Type | Description | Example |
---|---|---|---|
sessionKey * | string | Pass the Session key which received on successful registration. | ff8c2759-ba8e-4abe-a4a7-9f6d116194e9 |
onBatchListener * | string | Create an instance object & pass the object or create Anonymous callback to receive response. | new onBatchListener ();or new onBatchListener ({}); |
Response Parameters
Field | Type | Description | Example |
---|---|---|---|
onBatchSuccess * | string | Status message is shown when batch settlement done successfully. | |
onBatchError * | string | Status message is shown when batch settlement getting error. |
Snippet Code
ToPService topService = new ToPService(Activity activity);
topService.batchSettlement (sessionKey, new ToPService. onBatchListener {
@Override
public void onBatchSuccess(String success){
// sample success response
}
@override
public void onBatchError(String errorObject) {
// sample error response
}
@override
Public void onRegisterNeeded(JSONObject errorObject){
//sample error response
{
“error_code”:”960”,
“message”:”Session key is expired,To authenticate,please re-intiate device registration api”
}
}
});
Tip Adjustment API
This method is used to add tip amount for the existing transactions and, we can get the summary of adjust tipped transactions.
Request Parameters
Field | Type | Description | Example |
---|---|---|---|
sessionKey * | string | Pass the Session key which received on successful registration. | ff8c2759-ba8e-4abe-a4a7-9f6d116194e9 |
onTipListener * | string | Create an instance object & pass the object or create Anonymous callback to receive response. | new onTipListener (); or new onTipListener ({ }); |
Response Parameters
Field | Type | Description | Example |
---|---|---|---|
onTipSuccess * | string | Status message is shown when tip adjustment done successfully. | |
onTipError * | string | Status message is shown when tip adjustment getting error. |
Snippet Code
ToPService topService = new ToPService(Activity activity);
topService.tipAdjustment (sessionKey, new ToPService.onTipListener {
@Override
public void onTipSuccess(String success){
// sample success response
}
@override
public void onTipError(String errorObject) {
// sample error response
}
});
Reports API
The Transaction Detail Report gives a breakdown of transactions entered on a specified reporting period and includes information of the transactions.
Request Parameters
Field | Type | Description | Example |
---|---|---|---|
sessionKey * | string | Pass the Session key which received on successful registration. | ff8c2759-ba8e-4abe-a4a7-9f6d116194e9 |
onReportListener * | string | Create an instance object & pass the object or create Anonymous callback to receive response. | new onReportListener (); or new onReportListener ({ }); |
Response Parameters
Field | Type | Description | Example |
---|---|---|---|
onReportSuccess * | string | Status message is shown, once reports get displayed successfully. | |
onReportError * | string | Status message is shown when reports not displayed. |
Snippet Code
ToPService topService = new ToPService(Activity activity);
topService.showReport (sessionKey, new ToPService.onReportListener {
@Override
public void onReportSuccess(String success){
// sample success response
}
@override
public void onReportError(String error) {
// sample error response
}
});
Go Live Requirements
Replace the SDK version for the production environment in the application's build.gradle
file.
Help
Email us directly at devsupport@denovosystem.com with any questions or suggestions.