TransactionListener
Call the TransactionListener API to monitor transaction processes.
Method Signature
public interface TransactionListener {
void onTransactionStart();
void onTransactionComplete(@Nullable APTransactionContext transactionInfo);
void onTransactionFailed(@NotNull String errorCode, @Nullable TransactionInfo transactionInfo);
void onTransactionAuth();
}
// Register listener
ACTapManager.getInstance(context).setTransactionListener(new TransactionListener())Request parameters
Item | Type | Parameters | Description |
onTransactionStart() | Function | / | Called when a transaction starts or when the SDK receives the first APDU command. |
onTransactionComplete(@Nullable APTransactionContext transactionInfo)) | Function | APTransactionContext transactionInfo | Called when a transaction completes or when the SDK receives the final command. |
onTransactionFailed(@NotNull String errorCode, @Nullable TransactionInfo transactionInfo) | Function | String errorCode TransactionInfo transactionInfo | Called when a transaction fails. For more information, see Result codes. |
onTransactionAuth() | Function | / | Called when a transaction requires authentication. When called, onTransactionFailed is also called with error code 10003. For more information, see Result codes. |
APTransactionContext
Item | Type | Description |
mcc | String | Merchant MCC |
currencyCode | byte[] | Currency |
amount | byte[] | Transaction amount |
transactionRange | String | The transaction risk level under EMV standards varies by country and region, with different amount thresholds. Valid values are:
|
richTransactionType | String | Type of transactions. Valid values are:
|
TransactionInfo | TransactionInfo | Compatible with older versions, This parameter can be ignored. |
purpose | String | The purpose of the transaction.
|
expectedUserActionOnPoi | String | The expected user action to authorize this transaction at the point of interaction.
|
conditionsOfUse | String | Whether this transaction is local or cross-border.
|
Response parameters
N/A
Sample
class Demo implements TransactionListener {
@Override
public void onTransactionStart() {
log("received onTransactionStart");
}
@Override
public void onTransactionComplete(@Nullable APTransactionContext transactionInfo) {
log("received onTransactionComplete");
}
@Override
public void onTransactionFailed(@NonNull String errorCode, @Nullable TransactionInfo transactionInfo) {
log("received onTransactionFailed: " + errorCode);
}
@Override
public void onTransactionAuth() {
log("received onTransactionAuth");
Intent intent = new Intent(this, AuthActivity.class);
startActivity(intent);
}
}