Calling the SDK, parameters required and design data model class
Step1:
How to call the SDK:
! Notes :
|
Example
client_id: To be shared during integration |
client_secret: To be shared during integration |
Pass_key: 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 Transaction Type is being selected (Cash Withdrawal or Balance Enquiry).
- Then select the appropriate service device that is to be used (PAX or MoreFun).
- Enter the amount that needs to be withdrawn.
- Provide your registered mobile number.
- Fill in the key details, login id, along with API user name (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 sent to the SDK:
Name | Parameter name | Description | Valid Values (Type) and Validation | Mandatory /Optional |
Transact-ion Amount | transaction Amount | Transaction amount for cash withdrawal | Numeric. A minimum of 100 and a maximum of 10000. | Mandatory |
Transact-ion 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 |
HeaderSecrets | headerSecrets | Will be generated by using client id and client secret provided by iServeU | Alphanumeric String | Mandatory |
PassKey | passKey | 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 |
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; private String clientRefID; private String headerSecrets; private String passKey; String loginID; Boolean skipReceipt; 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 getHeaderSecrets() { return headerSecrets; } public void setHeaderSecrets(String headerSecrets) { this.headerSecrets = headerSecrets; } public String getPassKey() { return passKey; } public void setPassKey(String passKey) { this.passKey= passKey; } 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 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(balanceEnquiry); dataModel.setTransactionAmount("0"); } else if (rbCashWithdrawal.isChecked()) { dataModel.setTransactionType(SdkConstants.cashWithdrawal); dataModel.setTransactionAmount(etAmount.getText().toString().trim()); } dataModel.setApplicationType(""); dataModel.setDevice_type("pax"); dataModel.setUserName("upitestret"); dataModel.setLoginID("upitestret"); //Sdk user dataModel.setHeaderSecrets(" Refer Step 1 below for how to generate headersecrets"); dataModel.setPassKey("NNK7BD3GVEEQSFC3AYJW544MFQT2F33DS7OG4NJHWCFOFTG2HCKA "); dataModel.setApiusername("apisdktestapi"); dataModel.setShop_name("itpl"); 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); SdkConstants.MATMOnFinishListener = this; Intent intent = new Intent(MainActivity.this, MatmActivity.class); Gson gson = new Gson(); String getdata = gson.toJson(dataModel); intent.putExtra("data", getdata); intent.putExtra("supportEncryption", true) 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 this (SDKConstants.onFinishListener = this), 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" } |