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 |
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 WISEASY users, the device type should be
dataModel.setDevice_name = "Wiseasy" |
Step 2:
Required Parameters to be sent to the SDK:
Parameter name | Description | Valid Values (Type) and Validation | Mandatory /Optional |
transaction Amount | Transaction amount for cash withdrawal | Numeric. A minimum of 100 and a maximum of 10000. | Mandatory |
transaction Type | Type of transaction to be performed. | String | Mandatory |
shop_name | To be used as per client requirement | Alphanumeric String | Optional |
brand_name | To be used as per client requirement. | Alphanumeric String | Optional |
application Type | Application Category | String | Mandatory |
paramB | To be used as per client requirement | Alphanumeric String. Maximum length is 20. | Optional |
paramC | To be used as per client requirement | Alphanumeric String. Maximum length is 20. | Optional |
device_type | Terminal brand name | String | Mandatory |
device_name | Terminal model number | String | Optional |
apiUserName | API User’s Name | String | Mandatory |
ClientRefID | Reference ID of client. | Alphanumeric String. Maximum length is 18. | Mandatory |
headerSecrets | Will be generated by using client id and client secret provided by iServeU | Alphanumeric String | Mandatory |
passKey | Will be shared by iServeU | Alphanumeric String | Mandatory |
loginID | User application login ID or username | Alphanumeric String | Mandatory |
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 {
private String transactionAmount; private String transactionType; private String shop_name; private String brand_name; private String applicationType; private String paramB; private String paramC; private String loginID; private String apiUserName; private String user_mobile_number; private Boolean skipReceipt; private String device_type; private String device_name; private String clientRefID; private String clientID; private String clientSecret; private String headerSecrets; private String passKey ; 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 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 getApiUserName() { return apiUserName; } public void setApiUserName(String apiUserName) { this.apiUserName = apiUserName; } 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 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 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:
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. |
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); val bytes = getData.toString().toByteArray() val responseToBase64 = String(android.util.Base64.encode(bytes, android.util.Base64.NO_WRAP)) intent.putExtra("data", responseToBase64); 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.
Note: 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" } |