Card Service
TCardService provides basic card reading and pinpad functionality via providing AIDL interface. It is a BoundedService, which is only active when another application is bounded.
Integration
Download the zip file below and extract it.
Place the cardservicebinding-release.aar library file into your project's "libs" folder and add it as dependency inside your app level build.gradle file like below and build your project in order to create build classes of library.
dependencies { implementation fileTree(dir: 'libs', include: ['*.aar']) ... }
Inside Activity
public abstract class BaseActivity extends AppCompatActivity implements CardServiceListener {
protected CardServiceBinding cardServiceBinding;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
cardServiceBinding = new CardServiceBinding(this, this);
}
@Override
protected void onDestroy() {
//Make sure to call unBind() method when activity is finishing
cardServiceBinding.unBind();
super.onDestroy();
}
/**
* Callback for Card Service connected method. You will not need to check whether card service is connected or not in most cases.
* When you make an asynchronous method call on CardServiceBinding,it will be executed automatically as soon as CardService is connected.
*/
@Override
public void onCardServiceConnected() {
}
/**
* Callback for TCardService getCard method.
* As getCard is an asynchronous service operation, you will get the response after operation is done in this callback.
* @apiNote Override this method in your activity in order to get card data after calling #getData() method of Card Service.
* @param cardData: Card data json string
*/
public void onCardDataReceived(String cardData) { }
/**
* Callback for TCardService getOnlinePin method.
* As getOnlinePin is an asynchronous real time operation, you will get the response after operation is done in this callback.
* @apiNote Override this method in your activity in order to get pin data after calling #getOnlinePin() method of Card Service.
* @param pin: Pin string
*/
public void onPinReceived(String pin) {}
/**
* Callback for TCardService iccTakeOut method.
* This callback will be triggered when user takes out card from pos device after you inform the user with takeOutICC() method.
* @apiNote Override this method in your activity in order to get icc take out callback after calling #iccTakeOut() method of Card Service.
*/
public void onICCTakeOut() {}
}CardServiceBinding api methods
getCard(...) API Details
It is used to get card (ICC, MSR, CL) according to config of the API.
Inputs
int amount : amount of the sale.
int timeout: card read timeout as seconds.
String config:
forceOnline: Force EMV Txns Online.
fallback: Enable fallback.
zeroAmount: Show the amount data on screen however send to EMV kernel amount as "0".
keyIn: Enable keyIn on getCard screen.
askCVV: Enable CVV entry on keyIn screen.
showAmount: Show the amount data on screen.
extraAmount: This amount will be added to the main amount and displayed as the total amount on the screen. It will be excluded from the EMV processing. Please provide it as 100 x Float amount.
showCardScreen: Show the Card Screen. If pre-reading has been made by the platform please set is as "0"
partialEMV: Deprecated, please use emvProcessType.
qrPay: Enable QR button on Card Screen.
emvTxnType: EMV Txn Type. Sale: 0x00, Return: 0x20.
emvProcessType: It is used if txn is ICC. The types of the EMV process are below.
NOTE: X30TR does not support PARTIAL_EMV.
reqEMVData: Tags that requested for ICC Read Type. ICCData fields will be filled also according to requestedEMVData.
If it is not set by user, for READ_CARD it is set to "575A5F245F204F84", for other Txn Types it is set to "575A5F245F204F9B849F125F2A5F3482959A9C9F029F039F099F109F1A9F1E9F269F279F339F349F359F369F379F418E9F069F539F0D9F0E9F0F" by default.
Note 1:Please consider, it will take more time if you request more tags. Please make optimiziation on this tag to speed up the EMV Txn.
cardReadTypes:
currencySymbol: The ISO 4217 currency numeric code to show currency symbol on cardService screens. Ex:949 for TRY, 840 for USD.
forceICCTermCurrencyCode: For ICC transactions, temporarily set currencySymbol to 5F2A.
getOnlinePIN: Enable Online PIN during the getCard operation only for ICC transactions..
kmsVersion :
1 : Deprecated: Compatible with 400TR and 1000TR Castles-based systems.
2 : new KMS library, compatible with all devices.
keySet : allocated keySet value of the bank. Only set for kmsVersion 1. Not needed for kmsVersion 2.
keyIndex : keyIndex value of the PIN key.
minLen: min length of the requested PIN.
maxLen: max length of the requested PIN.
isDukptKey: it is set to 1 if the PIN key is Dukpt.
extraAmount: This amount will be added only to the main Amount and will be showed as Total Amount on the screen. It will be excluded from EMV process.
carPay: Specifically for 1000TR, it will be sent if In Car Pay is supported.
Returns
resultCode Values
ICC Card Type Return
CL Card Type Return
TransResult:
NOTE: Use this value to decide if the transaction will continue offline, online, or be declined.
0x0002 //d_EMVCL_OUTCOME_APPROVAL
0x0003 //d_EMVCL_OUTCOME_DECLINED
0x0004 //d_EMVCL_OUTCOME_ONL
SID:
CVMAnalysis:
Indicate which CVM is required
MSR Card Type Return
KeyIn Card Type Return
mCardReadType field values
completeEMVTxn(...) API Details
Actions after Online Processing, such as External Auth., Second Gen. AC, Issuer Script Processing.
Note: All ICC transactions must be completed in 330TR with completeEMVTxn. The EMV process is not completed until completeEmvTxn is called.
Inputs
action:
authRespCode: Response Code from the host. 2 bytes.
issuerAuthData: Issuer Authentication Data from the issuer host
issuerAuthDataLen: Length of the Issuer Authentication Data
issuerScript: Issuer Script from the issuer host
issuerScriptLen: Length of the Issuer Script
Returns
will be added...
getOnlinePIN(...) API Details
getOnlinePIN API used to get Encrypted PIN data.
Inputs
int amount : amount of the sale.
String pan : PAN of the used card
int keySet : allocated keySet value of the bank
int keyIndex : keyIndex value of the PIN key
int minLen: min length of the requested PIN
int maxLen: max length of the requested PIN
int timeout: max PIN entry period as sec.
Returns
pinData
getOnlinePINEx(String config) API Details
getOnlinePINEx API used to get Encrypted PIN with kmsVersion 2.
Note: Although this API is compatible with kmsVersion 1, as kmsVersion 1 has been deprecated, please use getOnlinePINEx.
Inputs
String config :
amount : amount of the sale.
PAN : PAN of the used card
kmsVersion :
1: Deprecated. Compatible with 400TR and 1000TR (Castles based).
2 : new KMS library, compatible with all devices.
keySet : allocated keySet value of the bank. Only set for kmsVersion 1. Not needed for kmsVersion 2.
keyIndex : keyIndex value of the PIN key.
minLen: min length of the requested PIN.
maxLen: max length of the requested PIN.
timeout: max PIN entry period as sec.
extraAmount: This amount will be added only to the main Amount and will be showed as Total Amount on the screen. It will be excluded from EMV process.
isDukptKey: it is set to 1 if the PIN key is Dukpt.
currencySymbol: The ISO 4217 currency numeric code to show currency symbol on cardService screens. Ex:949 for TRY, 840 for USD.
Returns
pinData
void takeOutICC(int timeout) API Details
takeOutICC is used to warn user to take out card.
Inputs
int timeout: take out period as sec.
String getEMVCompletionData();
Used to get EMV Completion data as JSON after completeEMVTxn API called.
Returns
Settings
setEMVConfiguration(...) API Details
setEMVConfiguration API sets the configuration settings of Banking App to kernel.
Note: The setEMVConfiguration should be called first and followed by the setEMVCLConfiguration.
Inputs
String config
Developer can create an xml file that is formatted like
You can see how the config file is created with the examples in this document.
Returns
will be added...
setEMVCLConfiguration(...) API Details
setEMVCLConfiguration API sets the Contactless configuration settings of Banking App to kernel.
Inputs
String config
Developer can create an xml file that is formatted like
You can see how the config file is created with the examples in this document.
You can also use this document to create tag combinations in the contactless config file.
Edit: Please set "0002" parameter in xml file, according to your timeout hex formatted and msecs.
For 30 secs it is set to 30000 as below.
Config XML files updated for AMEX.
Returns
will be added...
Compatible Version Info
330TR:
v340
Card screen animation removed
18.03.2024
v1050
-
v350
CL Track2Data error fix.
10.05.2024
v1150
-
v351
CL Tag DF81129 fix.
13.05.2024
-
-
v500
-PIN Status Messages -PINCtr Error Fix -JCB Error Fix -AID Label error fix -Some EMV tags added
20.11.2024
v1430
-
v510
-add forceICCTermCurrencyCode flag into getCard
29.11.2024
v1440
-
v520
-JPY decimal digits removed. -RUB symbol added.
20.12.2024
v1480
-
v530
-Currency symbol added for getOnlinePineX
27.12.2024
v1490
v540
-0x5F28 Tag added for Contactless transactions
27.01.2025
v1530
v590
-CVC Entry added(4 digits) -EMV Level 3 configurations have been updated.
09.05.2025
v1610
v600
-Abort transaction when Offline PIN Entry times out.
13.06.2025
v1630
v610
-Logs updated.
04.07.2025
v1670
v630
-Logs updated
22.09.2025
v1770
400TR:
v123
12.03.2024
v6.3.59
-
v125
-Extra amount value added getCard and getOnlinePinEx.
12.12.2024
v6.3.76
v126
-CVC Entry added(4 digits CVV)
20.03.2025
6.3.81
v128
-Logs updated.
16.06.2025
6.3.82
1000TR:
v68
28.02.2024
v7.3.87
-
v72
-In car payment added.
16.12.2024
v7.4.04
v74
-CVC Entry added(4 digits CVV) -Extra amount value added getCard and getOnlinePinEx.
29.05.2025
v7.4.26
v76
Pan number mask
13.10.2025
v7.4.36
For detailed version information, you can visit the page below.
Platform VersionsLast updated