Calling the SDK, parameters required and design data model class
Step1:
How to call the SDK:
Code snippet add into custom application class.
! Notes :
|
Example
client_id: To be shared during integration |
client_secret: To be shared during integration |
For MOREFUN users, the device type should be
dataModel.setDevice_name = “morefun” |
For PAX users, the device type should be
dataModel.setDevice_name = "pax" |
For PAX A910 users, the device type should be
dataModel.setDevice_name = "A910" |
For WISEASY users, the device type should be
dataModel.setDevice_name = "Wiseasy" |
Sample App View
- Select the appropriate service device that is to be used (PAX or MoreFun).
- Then the Transaction Type is being selected (Cash Withdrawal or Balance Enquiry).
- Fill in the required details (Here these details are required for Cash Withdrawal). And finally, click on the Initiate Transaction button to proceed with the transaction.
Image 1 (for PAX devices) - The available devices will be displayed that can be connected via Bluetooth. The Device IDs are displayed (as highlighted in the image) and clicking on it will get them connected and ready for transaction.
Image 2 (For MoreFun devices) –
- Search a new device to connect using the search bar.
- Click on the Is Connect button to connect the device and click the Disconnect button to get disconnected from the connected device.
- Displays the connected device.
Step 2:
Required Parameters to be send to the SDK:
Name | Parameter name | Description | Valid Values (Type) and Validation | Mandatory /Optional |
Transaction Amount | transaction Amount | Transaction amount for cash withdrawal | Numeric. A minimum of 100 and a maximum of 10000. | Mandatory |
Transaction Type | transaction Type | Type of transaction to be performed. | String | Mandatory |
Shop Name | shop_name | To be used as per client requirement | Alphanumeric String | Optional |
Brand Name | brand_name | To be used as per client requirement. | Alphanumeric String | Optional |
Application Type | application Type | Application Category | String | Mandatory |
Param B | paramB | To be used as per client requirement | Alphanumeric String. Maximum length is 20. | Optional |
Param C | paramC | To be used as per client requirement | Alphanumeric String. Maximum length is 20. | Optional |
Device Type | device_type | Terminal brand name | String | Mandatory |
Device name | device_name | Terminal model number | String | Optional |
API User Name | apiUserName | API User’s Name | String | Mandatory |
Client Reference ID | ClientRefID | Reference ID of client. | Alphanumeric String. Maximum length is 18. | Mandatory |
Client ID | clientID | Will be shared by iServeU | Alphanumeric String | Mandatory |
Client Secret | clientSecret | Will be shared by iServeU | Alphanumeric String | Mandatory |
Login ID | loginID | User application login ID or username | Alphanumeric String | Mandatory |
Skip Receipt | skipReceipt | If client wants to skip the receipt downloading part | Boolean. Default value is false. Set true to skip receipt download | Mandatory |
Theme Color | themeColor | Lets the client select its own theme | ThemeColor | Mandatory |
Step 3:
Data Model Class:
public class DataModel {
String transactionAmount; String transactionType; String shop_name; String brand_name; String applicationType; String paramB; String paramC; String device_type; String device_name; String apiUserName; String user_mobile_number; private String userName; private String clientRefID; private String clientID; private String clientSecret; String loginID; Boolean skipReceipt; ThemeColor themeColor; public ThemeColor getThemeColor() { return themeColor; } public void setThemeColor(ThemeColor themeColor){ this.themeColor = themeColor; } public String getApiUserName() { return apiUserName; } public void setApiUserName(String apiUserName) { this.apiUserName = apiUserName; } public String getClientRefID() { return clientRefID; } public void setClientRefID(String clientRefID) { this.clientRefID = clientRefID; } public String getClientID() { return clientID; } public void setClientID(String clientID) { this.clientID = clientID; } public String getClientSecret() { return clientSecret; } public void setClientSecret(String clientSecret) { this.clientSecret = clientSecret; } public Boolean getSkipReceipt() { return skipReceipt; } public void setSkipReceipt(Boolean skipReceipt) { this.skipReceipt = skipReceipt; } public String getTransactionAmount() { return transactionAmount; } public void setTransactionAmount(String transactionAmount) { this.transactionAmount = transactionAmount; } public String getTransactionType() { return transactionType; } public void setTransactionType(String transactionType) { this.transactionType = transactionType; } public String getShop_name() { return shop_name; } public void setShop_name(String shop_name) { this.shop_name = shop_name; } public String getBrand_name() { return brand_name; } public void setBrand_name(String brand_name) { this.brand_name = brand_name; } public String getApplicationType() { return applicationType; } public void setApplicationType(String applicationType) { this.applicationType = applicationType; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUser_mobile_number() { return user_mobile_number; } public void setUser_mobile_number(String user_mobile_number) { this.user_mobile_number = user_mobile_number; } public String getParamB() { return paramB; } public void setParamB(String paramB) { this.paramB = paramB; } public String getParamC() { return paramC; } public void setParamC(String paramC) { this.paramC = paramC; } public String getDevice_type() { return device_type; } public void setDevice_type(String device_type) { this.device_type = device_type; } public String getDevice_name() { return device_name; } public void setDevice_name(String device_name) { this.device_name = device_name; } public String getLoginID() { return loginID; } public void setLoginID(String loginID) { this.loginID = loginID; } }
|
Step 4:
Sample Code for passing data through the data model:
sample app view
! Notes For Cash Withdrawal the Amount (Should be greater than equal to 100 and less than equal to 10000 ) and the Mobile Number have to be filled in to proceed with the transaction. |
Please refer to the sample code below.
private void callMATMSDKApp() {
if (skipReceiptCB.isChecked()) { isSkip = true; } else { isSkip = false; } DataModel dataModel = new DataModel(); if (rbBalanceEnquiry.isChecked()) { dataModel.setTransactionType("0"); dataModel.setTransactionAmount("0"); } else if (rbCashWithdrawal.isChecked()) { dataModel.setTransactionType("1"); dataModel.setTransactionAmount(etAmount.getText().toString().trim()); } ThemeColor themeColor =new ThemeColor(); themeColor.setButtonBgColor("#000000"); themeColor.setButtonTextColor("#FFFFF"); DataModel dataModel = new DataModel(); dataModel.setThemeColor(themeColor); dataModel.setApplicationType(""); dataModel.setDevice_type("pax"); dataModel.setUserName("aepsTestR"); dataModel.setLoginID("aepsTestR"); //Sdk user dataModel.setClientID(""); //Client ID dataModel.setClientSecret("");//Client Secret key dataModel.setApiUserName("upitestret"); dataModel.setShop_name(""); dataModel.setBrand_name("iServeU"); dataModel.setDevice_name("paxd180"); dataModel.setClientRefID(et_clientRef.getText().toString()); dataModel.setParamB("branch1"); dataModel.setParamC("loanID1234"); dataModel.setUser_mobile_number("8949494949"); dataModel.setSkipReceipt(isSkip); MatmSdkConstants.Companion.setMATMOnFinishListener(this); Intent intent = new Intent(MainActivity.this, MatmActivity.class); Gson gson = new Gson(); String getdata = gson.toJson(dataModel); intent.putExtra("data", getdata); startActivity(intent); } |
Step 5:
Code Snippet for Callback Response (Optional for User):
OnFinishListener is a callback created to update the client app after Receipt Page (Success/Failure). It has a method called onSDKFinish() which will have mostly four parameters (status Txt, ClientRefID, statusDesc and a jsonObject). When the client app turns on the OnFinishListener by making SDKConstants to true (SDKConstants.onFinishListener = true), the SDK will initiate the callback through onSDKFinish after finishing the Receipt page.
Notes : User can check the Status & ClientRefID value using this Callback Method.
Java :
MatmSdkConstants.Companion.setMATMOnFinishListener(this); |
Kotlin :
MatmSdkConstants.MATMOnFinishListener = this |
Implements MATMOnFinishListener in the Activity where this below method will override.
@Override
public void onSDKFinish(String statusTxt, String ClientRefID, String statusDesc, JSONObject jsonObject) { Toast.makeText(MainActivity.this, statusTxt + ClientRefID + statusDesc + jsonObject, Toast.LENGTH_SHORT).show(); Log.d("transactionData", jsonObject.toString());// Please refer below for further details. } |
Required Keys to get the transaction data from the Callback:
Key Name | Name | Description |
FLAG | flag | Status of the Transaction |
TRANSACTION_ TYPE | Transaction Type |
Type of transaction performed. “1” signifies a cash withdrawal “0” signifies a balance enquiry |
TRANSACTION_ID | Transaction ID | Transaction ID |
RRN_NO | Rrn no | 12 digit RRN Number |
RESPONSE_CODE | Response code | To be used by the client as per requirement |
AMOUNT | Amount | Amount being transacted. |
MID | MID | Merchant Identification Number |
TID | TID | Terminal Identification Number |
TXN_ID | Txn ID | Transaction ID |
INVOICE | Invoice | Invoice number for the transaction |
CARD_TYPE | Card type | Type of card used in transaction. |
APPR_CODE | Appr code | Approval Code |
CARD_NUMBER | Card number | Card Number used in the Transaction |
CARD_HOLDERNAME | Card holder name | Name of the card holder. |
SHOP_NAME | Shop Name | Name of the Shop |
BRAND_NAME | Brand Name | Name of the Brand |
An example of a successful transaction
{
"FLAG": "success", "TRANSACTION_ID": "1023948334970183680", "TRANSACTION_TYPE": "0", "RRN_NO": "226918141134", "RESPONSE_CODE": "0000", "AMOUNT": "369.70",//If balance is in -ve then amount will be -369.70 "MID": "IS0999999995469", "TID": "07002782", "TXN_ID": "1234567", "INVOICE": "1111111", "CARD_TYPE": "visa", "APPR_CODE": "123456", "CARD_NUMBER": "xxxx-xxxx-xxxx-9167", "CARD_HOLDERNAME": "", "BRAND_NAME": "IndiaPost", "SHOP_NAME": "Testing" } |