EdfaPay Logo

API Reference

Complete public API for EdfaPayPlugin — initialization, payments, transactions, reconciliation, terminal, session, and utilities.

Overview

All SDK functionality is accessed through the EdfaPayPlugin singleton object. Utility methods are under EdfaPayPlugin.Utils.

Loading...
1

Initialization

initiate

Initialize the SDK with merchant credentials. Must be called before any payment operations.

Loading...

Parameters

contextFragmentActivity for UI operations
credentialsEdfaPayCredentials with auth token or email/password
onSuccessCalled with EP instance and session ID
onErrorCalled on initialization failure
PropertyTypeDescription
environmentEnvTarget environment (SANDBOX, PRODUCTION, etc.)
emailString?User email (for credential login)
passwordString?User password (for credential login)
tokenString?Auth token (for token login)
isTokenLoginBooleantrue when token is provided (computed)
2

Payment Operations

All payment methods share the same callback pattern. The flowType parameter controls the UI flow (IMMEDIATE, STATUS, or DETAIL).

purchase

Process a standard sale transaction.

Loading...

Parameters

activityFragmentActivity for UI (optional)
flowTypeUI flow type (default: DETAIL)
txnParamsTransaction parameters (amount, type, originalTransaction)
onPaymentProcessCompleteCalled with (status, code, transaction, isFlowComplete)
onErrorCalled on error
onRequestTimerEndCalled on server request timeout
onCardScanTimerEndCalled on card scan timeout
onCancelByUserCalled when user cancels

authorize

Pre-authorize a payment (hold funds without capturing).

Loading...

capture

Capture a previously authorized transaction. txnParams.originalTransaction is required.

Loading...

refund

Refund a previous purchase. txnParams.originalTransaction is required.

Loading...
3

Transaction Management

void

Void an unsettled transaction. Pass null to void the last transaction.

Loading...

Parameters

activityFragmentActivity for UI
transactionTransaction to void (null for last)
onSuccessCalled with TxnResponse
onErrorCalled on error

reverse

Reverse a transaction. Used for timeout or error recovery.

Loading...

Parameters

activityFragmentActivity for UI
transactionTransaction to reverse
onSuccessCalled with TxnResponse
onErrorCalled on error

reverseLastTransaction

Convenience method to reverse the most recent transaction. Throws if not reversible.

Loading...
4

Transaction History

txnHistory

Retrieve paginated transaction history for the current terminal.

Loading...

Parameters

paginationOptional Pagination (page, sort, size)
onSuccessCalled with List<Transaction>
onErrorCalled on error

txnDetail

Get details of a specific transaction by ID.

Loading...

Parameters

txnIdTransaction ID (UUID string)
onSuccessCalled with Transaction
onErrorCalled on error
5

Reconciliation

reconcile

Perform end-of-day reconciliation for the current terminal.

Loading...

Returns

Reconcile object with reconciliationInfo and per-scheme breakdowns

reconciliationHistory

Get a list of past reconciliation batches.

Loading...

Returns

List of ReconciliationHistory records

reconciliationDetail

Get details of a specific reconciliation batch.

Loading...

Parameters

idReconciliation batch ID

reconciliationReceipt

Get a printable receipt for a reconciliation batch.

Loading...

Parameters

idReconciliation batch ID
6

Terminal Management

terminalInfo

Retrieve terminal information for the current session.

Loading...

Returns

TerminalInfo with deviceId, tsn, terminalId, merchantId, merchantName, version

activateTerminal

Activate the terminal for payment processing.

Loading...

Parameters

passwordOptional password if required

deActivateTerminal

Deactivate the terminal. Disables payment processing until reactivated.

Loading...

Parameters

passwordOptional password if required

syncTerminal

Download latest EMV parameters, card schemes, and terminal configuration.

Loading...
7

Session Management

getSessionList

Get all stored sessions for logged-in terminals.

Loading...

Returns

List<SessionDetail>

logoutCurrentSession

Logout the current session and clear stored credentials.

Loading...

logoutSession

Logout a specific session by ID.

Loading...

Parameters

sessionIdThe session ID to logout
8

Extension API — EdfaPayPlugin.Extension

Advanced login, terminal registration, OTP, and configuration methods. Accessed via EdfaPayPlugin.Extension. Must be initialized with init() before use.

init

Initialize the Extension module. Required before calling any other Extension method.

Loading...

Parameters

contextFragmentActivity for UI and configuration
onErrorCalled with EdfaException on failure
onSuccessCalled with Boolean indicating if existing session was restored

loginWithCredentials

Login using email and password. Returns a Login object with session info.

Loading...

Parameters

emailUser email address
passwordUser password
locationDevice location (required for security)
onSuccessCalled with Login object

loginWithToken

Login using a pre-issued auth token. Returns an SdkLogin session.

Loading...

Parameters

tokenPre-issued authentication token
locationDevice location (required for security)

verifyOtp

Verify an OTP code after credential login (when 2FA is enabled).

Loading...

Parameters

sessionIdSession ID from login response
otpOne-time password code

resendOtp

Resend the OTP code to the user.

Loading...

Parameters

sessionIdSession ID from login response

getAvailableTerminal

Get a list of terminals available for registration.

Loading...

Returns

List of Terminal objects available for binding

registerTerminal

Register/bind a terminal by its TRSM (Terminal Reference Security Module) ID.

Loading...

Parameters

trsmTerminal TRSM identifier to register

getInitialKey

Retrieve initial encryption keys for the terminal.

Loading...

getTerminalConfig

Download terminal configuration (EMV parameters, card schemes). Saves session, keys, and config.

Loading...

Parameters

forceDownloadForce re-download even if config exists (default: false)
configurationTypeConfiguration scope (default: FULL_TERMINAL_CONFIGURATION)

renewSessionIfRequiredAndPossible

Renew the session token if expired or near expiry, using the stored refresh token.

Loading...

initKernels

Initialize EMV card processing kernels (Mastercard, Visa, etc.).

Loading...

Parameters

completionOptional callback with list of initialized kernel names

prepareTerminalWithToken

Convenience method: init → loginWithToken → getTerminalConfig → initKernels in one call.

Loading...

Parameters

contextFragmentActivity for UI
locationDevice location
tokenAuth token
onSuccessCalled with EP instance and session ID when fully ready
9

Utilities — EdfaPayPlugin.Utils

MethodSignatureDescription
currentLocation(Context, (Location?, Boolean) -> Unit)Get current device location with permission status
haveLocationPermission(Context): BooleanCheck if location permission is granted
requestLocationPermission(FragmentActivity, (Boolean) -> Unit)Request location permission from user
isLocationMocked(Location?): BooleanDetect if location is spoofed/mocked
getDeviceId(Context): StringGet unique device identifier (UUID)
saveData(Key, String, onSuccess, onError)Save key-value data to secure storage
getData(Key, onError): String?Retrieve data from secure storage
showMessageDialog(FragmentActivity, title, message, onClose?)Display a message dialog to the user
9

Data Models

10

Enums

TransactionType

ValueDescription
PURCHASEStandard sale transaction
AUTHORIZEPre-authorization (hold funds)
CAPTURECapture pre-authorized amount
REFUNDRefund a previous purchase
REVERSALReverse/cancel a transaction
VOIDVoid unsettled transaction
CASHBACKPurchase with cashback

FlowType

ValueDescription
IMMEDIATEMinimal UI, quick processing
STATUSShows transaction status only
DETAILFull transaction details and receipt (default)

Env

ValueDescription
SANDBOXTesting/sandbox environment
PRODUCTIONLive production environment
DEMODemo environment

Presentation

Controls how the SDK UI is displayed. Each value supports chainable configuration methods.

ValueDescription
FULLSCREENFull screen display
DIALOG_CENTERCentered dialog
DIALOG_BOTTOM_FILLBottom sheet (full width)
DIALOG_BOTTOM_CENTERBottom sheet (centered)
DIALOG_BOTTOM_STARTBottom sheet (start-aligned)
DIALOG_BOTTOM_ENDBottom sheet (end-aligned)
DIALOG_TOP_FILLTop sheet (full width)
DIALOG_TOP_CENTERTop sheet (centered)
DIALOG_TOP_STARTTop sheet (start-aligned)
DIALOG_TOP_ENDTop sheet (end-aligned)

Chainable Methods

MethodDefaultDescription
sizePercent(Float?)1.0Dialog size (0.0 to 1.0)
setPurchaseSecondaryAction(action)NONEPost-purchase action button
setShufflePinPad(Boolean)falseRandomize PIN pad layout
dismissOnTouchOutside(Boolean)trueDismiss on outside tap
dismissOnBackPress(Boolean)trueDismiss on back button
cornerRadius(Int)16Dialog corner radius (dp)
dimAmount(Float)0.5Background dim opacity
animateEntry(Boolean)trueEntry animation
animateExit(Boolean)trueExit animation

PurchaseSecondaryAction

ValueDescription
NONENo secondary action button
REVERSEShow reverse button after purchase
REFUNDShow refund button after purchase
11

Callback Types

The SDK uses an asynchronous callback-driven architecture to communicate transaction states, errors, and user interactions back to your application.

TransactionCompleteCallback

The primary hook for transaction results. It is triggered when a transaction reaches a final state (Success or Failure) and provides the associated data.

PropertyTypeDescription
statusBooleanTrue if the transaction was approved by the host.
codeString?The response code from the server (e.g., '00' for success).
transactionTransaction?The detailed transaction record. Null if the flow failed before reaching the host.
isFlowCompleteBooleanCrucial: True when the SDK's UI flow (dialogs, receipts) has fully finished.

Handling isFlowComplete

You should only navigate away from the current screen or trigger disruptive UI updates whenisFlowComplete is true. The callback may be triggered twice: once with the result (isFlowComplete=false) and finally when the UI is dismissed (isFlowComplete=true).

ErrorCallback

Catch-all for exceptions occurring within the SDK logic or networking layer.

throwable— Typically an EdfaException containing an error code and message.

TimeoutCallback

Triggered when an operation exceeds its allotted time. The SDK defines two main timeout scenarios:

  • Request Timer: Server communication took too long.
  • Scan Timer: The user did not present a card within the required window.

CancellationCallback

Triggered when the user explicitly cancels the transaction flow (e.g., tapping the back button or the 'X' button in the UI).

Language Type Definitions

Loading...

Backward Compatibility

The SDK has been modernized with standardized naming conventions. While the older typealiases remain functional for backward compatibility, we recommend migrating to the new signatures for improved code clarity.

Deprecated NameCurrent Name
ProcessCompleteCallbackTransactionCompleteCallback
ServerCompletionCallBackServerResponseCallback
PluginCallBackCardProcessingCallback
TimeOutCallBackTimeoutCallback
CancelByUserCallBackCancellationCallback
OnErrorCallBackErrorCallback