Description
The Transaction Search function is used to retrieve details of previous transactions.
Request
Parameters
The following table describes the parameters of the TX_SEARCH request message.
PARAMETER | TYPE | DESCRIPTION | EXAMPLE |
---|---|---|---|
REQUIRED | |||
launchType | STRING | Must be “TX_SEARCH” Used for launching the Ecentric Payment App to perform a transaction search query. | TX_SEARCH |
merchantID | STRING | The merchant ID assigned to the merchant. | 945230000000001 |
authenticationKey | STRING | The authentication token that was generated by the server on a successful login to the Ecentric Payment App | e27b5456-8bff6-4746-94bg-367253356eb |
OPTIONAL | |||
transactionUuid | STRING | Unique ID (UUID) of transaction if searching for a specific transaction.. | 79f451e7-edc9-4f9e-8625-18618f597a8f |
Sample Code
private void doTxSearch() {
Intent intent = new Intent();
intent.setClassName("com.ecentric.ecentricpay", "com.ecentric.ecentricpay.MainActivity");
Bundle dataBundle = new Bundle();
dataBundle.putString("launchType", "TX_SEARCH");
dataBundle.putString("merchantID", "910100000000001");
dataBundle.putString("authenticationKey", "received_authenticationKey");
dataBundle.putString("transactionUuid", "78a501e7-edc9-4f9e-8625-18618f597a8f"); // Returns last transaction or specific transaction if UUID is specified
intent.putExtra("ecentricBundle", dataBundle);
try {
intentLauncher.launch(intent);
} catch (Exception e) {
Log.e(TAG, "Error launching intent: " + e);
}
}
Response
Parameters
The following table describes the parameters of the TX_SEARCH response message.
PARAMETER | TYPE | DESCRIPTION | EXAMPLE |
---|---|---|---|
launchType | STRING | Echo of the launchType used to launch the Ecentric Payment App. | TX_SEARCH |
resultCode | STRING | Represents the result status of the TX Search intent call: ● 01: SUCCESSFUL ● 02: DECLINED ● 04: ERROR | 01 |
isReceiptDataAvailable | BOOL | Boolean indicating whether a receiptBundle object is available. Will always be included for approved or declined transactions. | true |
receiptBundle | STRING | Consists of a sub-bundle of server parameters that can be used by the partner application to create a receipt. | See Sample ecentricBundle SALE Response. |
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 |
transactionAmount | LONG | Approved total transactionAmount. | 1000 |
cashAmount | LONG | Approved cashAmount. | 500 |
transactionUuid | STRING | Unique ID of transaction | bdf9d0af-17b3-48ca-8a0b-37dc52bf49bc |
appVersion | STRING | The software version currently running on the Ecentric Payment App. | 2.0.0 |
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");
Boolean success = false;
if (resultCode != null && (resultCode.matches("00") || resultCode.matches("01"))) {
success = true;
}
if (success && launchType.matches("RETAIL_AUTH")) {
authenticationKey = responseBundle.getString("authenticationKey");
}
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"