Description
The Card Query function is used to obtain card information by means of swiping the card on the payment device.
Request
Parameters
The following table describes the parameters of the CARDQUERY request message.
PARAMETER | TYPE | DESCRIPTION | EXAMPLE |
---|---|---|---|
REQUIRED | |||
launchType | STRING | Must be “CARDQUERY” Used for launching the Ecentric Payment App to perform a card query. | CARDQUERY |
merchantID | STRING | The merchant ID assigned to the merchant. | 971234500000003 |
authenticationKey | STRING | The authentication token that was generated by the server on a successful auth call to the Ecentric Payment App | e27b6ce6-78ba6-4y46-9953-5afr28f7cbeb |
Sample Code
private void doCardQuery() {
Intent intent = new Intent();
intent.setClassName("com.ecentric.ecentricpay", "com.ecentric.ecentricpay.MainActivity");
Bundle dataBundle = new Bundle();
dataBundle.putString("launchType", "CARDQUERY");
dataBundle.putString("merchantID", "910100000000001");
dataBundle.putString("authenticationKey", "received_authenticationKey");
addDefaultToIntentBundle(dataBundle);
intent.putExtra("ecentricBundle", dataBundle);
try {
intentLauncher.launch(intent);
} catch (Exception e) {
Log.e(TAG, "Error launching intent: " + e);
}
}
Response
Parameters
PARAMETER | TYPE | DESCRIPTION | EXAMPLE |
---|---|---|---|
launchType | STRING | Echo of the launchType used to launch the Ecentric Payment App. | CARDQUERY |
resultCode | STRING | Represents the result of the card query intent call: ● 00: COMPLETED ● 04: ERROR | 00 |
merchantID | STRING | Echo of the merchantID used in the request. | 910100000000001 |
resultDescription | STRING | A user readable representation of the above resultCode i.e. Approved for resultCode 01. | COMPLETED |
track1Data | STRING | Contents of track 1 if available | B5210955001511518^ /^29056270000015400000000000000000000000000000 |
track2Data | STRING | Contents of track 2 if available | 5210955001511518=29056270000000154000 |
panData | STRING | PAN of card if available | 5210955001511518 |
transactionUuid | STRING | Unique ID of transaction. | bdf9d0af-17b3-48ca-8a0b-37dc52bf49bc |
serialNumber | STRING | The serial number for the device that was used for the CARDQUERY intent call. | PC05P2CB14336 |
appVersion | STRING | The software version currently running on the Ecentric Payment App. | 1.9.2 |
Sample Code
private final ActivityResultLauncher<Intent> intentLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getResultCode() == Activity.RESULT_OK) {
Intent data = result.getData();
if (data != null) {
Bundle responseBundle = new Bundle(data.getBundleExtra("ecentricApplicationResponse"));
String launchType = responseBundle.getString("launchType");
String resultCode = responseBundle.getString("resultCode");
String track1Data = responseBundle.getString("track1Data");
String track2Data = responseBundle.getString("track2Data");
String panData = responseBundle.getString("panData");
Boolean success = false;
if (resultCode != null && (resultCode.matches("00") || resultCode.matches("01"))) {
success = true;
}
if (responseBundle.get("errorBundle") != null) {
Bundle errorBundle = new Bundle(responseBundle.getBundle("errorBundle"));
}
}
} else {
Log.e(TAG, "Received error resultCode: " + result.getResultCode());
}
}
);
Error Handling
Sample Bundle
"resultDescription": "ABORTED",
"errorBundle": {
"description": "ERROR",
"reference": "",
"errorType": "OTHER",
"message": "Transaction cancelled by user"
},
"buildInfo": "Ecentric_DEBUG_Ecentric_INT",
"resultCode": "03",
"merchantID": "910100000000001",
"serialNumber": "PC05P2CG10036",
"launchType": "CARDQUERY",
"appVersion": "1.9.8"