Powered by Soft Space Sdn. Bhd.
201201002345 (975870-D)
www.softspace.com.my

SDK APIs

SDK APIs

SSMPOSSDK

This section documents the public API that the app could use for attestation, and transaction purposes.

init

This method initializes the Fasstap™ MPOS SDK, with the sent in configurations.

init(Context context, SSMPOSSDKConfiguration configuration)

PARAMETER

contextContext

Context of the caller class.

configurationSSMPOSSDKConfiguration

SSMPOSSDKConfiguration object that contains all the configuration information to configure the Fasstap™ MPOS SDK.

RETURN VALUE

SSMPOSSDK

Singleton object that represents Fasstap™ MPOS SDK.

SAMPLE
Context context = getApplicationContext();
SSMPOSSDKConfiguration config = SSMPOSSDKConfiguration.Builder.create()
	.setAttestationHost(BuildConfig.ATTESTATION_HOST)
	.setAttestationHostCertPinning(BuildConfig.ATTESTATION_CERT_PINNING)
	.setAttestationHostReadTimeout(10000L)
	.setAttestationRefreshInterval(300000L)
	.setAttestationStrictHttp(true)
	.setAttestationConnectionTimeout(30000L)
	.setLibGooglePlayProjNum("757874674469") // use own google play project number
	.setLibAccessKey(BuildConfig.ACCESS_KEY)
	.setLibSecretKey(BuildConfig.SECRET_KEY)
	.setUniqueID(edtUserID.getText().toString()) // please set the userID shared by Soft Space
	.setDeveloperID(edtDeveloperID.getText().toString())
	.setEnvironment(BuildConfig.FLAVOR_environment.equals("uat") ? Environment.UAT : Environment.PROD)
	.build();

SSMPOSSDK.init(context, config);

getInstance

This method returns the initialized SSMPOSSDK singleton. Please do make sure init is called prior to calling this method, IllegalStateException shall be thrown if otherwise.

getInstance()

RETURN VALUE

SSMPOSSDK

Singleton object that represents Fasstap™ MPOS SDK.

getTransaction

This method returns the Transaction representation object that can be used to handle transactions upon Fasstap™ MPOS SDK initialized successfully.

getTransaction()

RETURN VALUE

Transaction

Transaction object that’s used to handle transaction related operations.

hasRequiredPermission

Check if the app has already granted with the Fasstap™ MPOS SDK required permissions.

hasRequiredPermission(Context context)

PARAMETER

contextContext

Context of the caller class.

configurationSSMPOSSDKConfiguration

SSMPOSSDKConfiguration object that contains all the configuration information to configure the Fasstap™ MPOS SDK.

RETURN VALUE

boolean

Flag indicates if the app has granted with the necessary permissions.

requestPermissionIfRequired

Have the Fasstap™ MPOS SDK request for the necessary permissions.

requestPermissionIfRequired(Activity app, int code)

PARAMETER

appActivity

The activity that is requesting for the permission so Android framework could handle the request prompt. The activity should also overrides onRequestPermissionsResult.

Once Android Framework has prompted the user to enable the necessary permissions, main project should forward the grantResults back to AttestationPOG.hasGrantPermission() method for validating.

codeint

The request code that Android’s Framework should be forwarding back to main project’s onRequestPermissionResult callback.

RETURN VALUE

boolean

Flag indicates if the permissions have all been granted prior to calling this method.

If it is true, Fasstap™ MPOS SDK shall not request for permissions. If otherwise, Fasstap™ MPOS SDK shall proceed to request for permissions and return false immediately, main project shall implements onRequestPermissionResult to listen to user’s action if this method returns false.

hasGrantPermission

Check if the permissions requested are all granted without issue. Please make a call to requestPermissionIfRequired method prior to this.

hasGrantPermission(int[] grantResult)

PARAMETER

grantResultint[]

The grant results forwarded from onRequestPermissionsResults.

RETURN VALUE

boolean

Flag indicates if the permissions have all been granted.

isRunningOnRemoteProcess

Check if the application is running on remote process.

isRunningOnRemoteProcess(Context context)

PARAMETER

contextContext

The context of application.

RETURN VALUE

boolean

Flag indicates if the application is running on remote process.

getCotsId

To get the device ID.

getCotsId()

RETURN VALUE

String

Device ID.

getSdkVersion

To get the Fasstap™ MPOS SDK version.

getSdkVersion()

RETURN VALUE

String

Fasstap™ MPOS SDK version.

SSMPOSSDKConfiguration

This is the configuration class that is uses to configure the Fasstap™ MPOS SDK. This class does not have exposable API, but it contains a builder class that could be used to set the configuration value. The builder class will be discussed in the following section.

SSMPOSSDKConfiguration.Builder

This is the builder class for SSMPOSSDKConfiguration.

create

Create a new SSMPOSSDKConfiguration.Builder object.

create()

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setLibAccessKey

To set the Access Key. This field is mandatory. Soft Space will provide the Access Key.

setLibAccessKey(String libAccessKey)

PARAMETER

libAccessKeyString

The access key given by Soft Space.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setLibSecretKey

To set the Secret Key. This field is mandatory. Soft Space will provide the Secret Key.

setLibSecretKey(String libSecretKey)

PARAMETER

libSecretKeyString

The Secret key given by Soft Space.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setLibGoogleApiKey

To set the Google API Key for Google Safetynet Attestation purpose. This field is mandatory.
This requires developer to register an account under Google Developer Console > Android Device Verification API. For more information, please visit this link.

setLibGoogleApiKey(String libGoogleApiKey)

PARAMETER

libGoogleApiKeyString

The Google API key obtains from Google Developer Console site.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setLibGooglePlayProjNum

To set the Google Play Project Number for Google Play Integrity API purpose. This field is mandatory. Refer to Play Integrity Enrolment guide.

setLibGooglePlayProjNum(String libGooglePlayProjNum)

PARAMETER

libGooglePlayProjNumString

The Google Play Project Number obtains from Google Cloud Console.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setAttestationHost

To set the attestation server’s URL. This field is mandatory if attestation is enabled.

setAttestationHost(String attestationHost)

PARAMETER

attestationHostString

The attestation server’s URL.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setAttestationRefreshInterval

To set the attestation refresh interval in milliseconds. This interval serves as the time before next attestation would kick start automatically in the background after one attestation has done.

setAttestationRefreshInterval(Long attestationRefreshInterval)

PARAMETER

attestationRefreshIntervalLong

The attestation refresh interval in milliseconds.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setAttestationHostReadTimeout

To set the attestation host’s socket read timeout value in milliseconds.

setAttestationHostReadTimeout(Long attestationHostReadTimeout)

PARAMETER

attestationHostReadTimeoutLong

The attestation host's socket read timeout value in milliseconds.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setAttestationConnectionTimeout

To set the attestation host’s socket connection timeout value in milliseconds.

setAttestationConnectionTimeout(Long attestationConnectionTimeout)

PARAMETER

attestationConnectionTimeoutLong

The attestation host's connection timeout value in milliseconds.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setAttestationStrictHttp

To set if the attestation host is using certificate pinning.

setAttestationStrictHttp(Boolean attestationStrictHttp)

PARAMETER

attestationStrictHttpBoolean

Flag if SDK should use Certificate pinning for verification.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setAttestationHostCertPinning

To set the attestation host’s certificate if SDK should verify with certificate pinning method.

setAttestationHostCertPinning(String attestationHostCertPinning)

PARAMETER

attestationHostCertPinningString

Attestation server’s certificate.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setUniqueID

To set the unique ID provided by Soft Space.

setUniqueID(String uniqueID)

PARAMETER

uniqueIDString

The uniqueID from Soft Space.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setDeveloperID

To set the developer ID provided by Soft Space.

setDeveloperID(String developerID)

PARAMETER

developerIDString

The developerID from Soft Space.

RETURN VALUE

SSMPOSSDKConfiguration.Builder

A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

setEnvironment

To set the environment of SDK, configuration file is required as per each of the different Environment:

  • DEV: config_dev.env
  • SIT: config_sit.env
  • UAT: config_uat.env
  • PROD: config_prod.env
  • setEnvironment(Environment environment)
    

    PARAMETER

    environmentEnvironment

    The environment of SDK.

    RETURN VALUE

    SSMPOSSDKConfiguration.Builder

    A new SSMPOSSDKConfiguration.Builder that could be used to set configuration values.

Transaction

This is the interface representation of transactional handling of Fasstap™ MPOS SDK. It provides API for to start transaction, etc. It also holds the transactional result codes while processing transactions. Upon initing the Fasstap™ MPOS SDK successfully, main project could then make API call via SSMPOSSDK.getInstance().getTransaction() to obtain the Transaction class and starts.

startTransaction

Instruct Fasstap™ MPOS SDK to start a transaction with the MPOSTransactionParams. This will make Fasstap™ MPOS SDK starts listening to NFC events and the card events (like user tapped card, or timeout occurs) will be reflected with onTransactionUIEvent method in TransactionEvents.

Various transaction events that requires main project to handle the implementation will take place under TransactionEvents interface too. For more information regarding TransactionEvents, please refer to MPOSTransaction.TransactionEvents.

Eventhough Fasstap™ MPOS SDK handles the NFC events itself, it does not render any UI that instructs user to tap card on the phone. Prompting user with proper tap card UI before calling startTransaction is strongly recommended.

startTransaction(Activity context, MPOSTransactionParams trxParams, TransactionEvents callback)

PARAMETER

contextActivity

The activity that starts the transaction. Please note that Activity class instance is required here instead of plain context.

trxParamsMPOSTransactionParams

The parameters for this transaction like amount. For more information, please refer to MPOSTransactionParams.

callbackTransactionEvents

The callback implementation class for various transactional and card events. Please refer to MPOSTransaction.TransactionEvents.

RETURN VALUE

Boolean

A flag that is indicating if the transaction has started successfully. Please take note that this flag does not indicate the transaction has been carried out successfully. Transaction results or events will be done via TransactionEvents callback.

SAMPLE
MPOSTransactionParams transactionalParams = MPOSTransactionParams.Builder.create() 
	.setReferenceNumber("referenceNo") 
	.setAmount("1000") 
	.build(); 

 SSMPOSSDK.getInstance().getTransaction().startTransaction(this, transactionalParams, new MPOSTransaction.TransactionEvents() { 
	@Override 
	public void onTransactionResult(int result, MPOSTransactionOutcome transactionOutcome) { 
 
		runOnUiThread(new Runnable() { 
			@Override 
			public void run() { 
				if(result == TransactionSuccessful) 
				{ 
					String outcome = "Transaction ID :: " + transactionOutcome.getTransactionID() + "\n"; 
					outcome += "Reference No :: " + transactionOutcome.getReferenceNo() + "\n"; 
					outcome += "Approval code :: " + transactionOutcome.getApprovalCode() + "\n"; 
					outcome += "Card number :: " + transactionOutcome.getCardNo() + "\n"; 
					outcome += "Cardholder name :: " + transactionOutcome.getCardHolderName() + "\n"; 
					outcome += "Acquirer ID :: " + transactionOutcome.getAcquirerID() + "\n"; 
					outcome += "RRN :: " + transactionOutcome.getRrefNo(); 
				} 
				else 
				{ 
					if(transactionOutcome != null) 
					{ 
						writeLog(transactionOutcome.getStatusCode() + " - " + transactionOutcome.getStatusMessage()); 
					} 
					else 
					{ 
						writeLog("Error ::" + result); 
					} 
				} 
			} 
		}); 
	} 
 
	@Override 
	public void onTransactionUIEvent(int event) { 
		runOnUiThread(new Runnable() { 
			@Override 
			public void run() { 
				if (event == TransactionUIEvent.CardReadOk) 
				{ 
					// you may customize card reads OK sound & vibration, below is some example 
					ToneGenerator toneGenerator = new ToneGenerator(AudioManager.STREAM_MUSIC, ToneGenerator.MAX_VOLUME); 
					toneGenerator.startTone(ToneGenerator.TONE_DTMF_P, 500); 
 
					Vibrator v = (Vibrator) MainActivity.this.getSystemService(Context.VIBRATOR_SERVICE); 
					if (v.hasVibrator()) 
					{ 
						v.vibrate(VibrationEffect.createOneShot(200, VibrationEffect.DEFAULT_AMPLITUDE)); 
					} 
				} 
				else if (event == TransactionUIEvent.RequestSignature) 
				{ 
					writeLog("Signature is required"); 
				} 
			} 
		}); 
	} 
});

abortTransaction

To try to cancel an ongoing transaction.

abortTransaction()

RETURN VALUE

Boolean

A flag that indicates if the transaction has cancelled successfully.

startQRTransaction

Instruct Fasstap™ MPOS SDK to start a QR transaction with the MPOSTransactionParams. This will generate a QR related response in TransactionOutcome.

Various transaction events that requires main project to handle the implementation will take place under TransactionEvents interface too. For more information regarding TransactionEvents, please refer to MPOSTransaction.TransactionEvents.

startQRTransaction(Activity context, MPOSTransactionParams trxParams, TransactionEvents callback)

PARAMETER

contextActivity

The activity that starts the transaction. Please note that Activity class instance is required here instead of plain context.

trxParamsMPOSTransactionParams

The parameters for this transaction like amount & QR Type. For more information, please refer to MPOSTransactionParams.

callbackTransactionEvents

The callback implementation class for various transactional and card events. Please refer to MPOSTransaction.TransactionEvents.

RETURN VALUE

Boolean

A flag that is indicating if the transaction has started successfully. Please take note that this flag does not indicate the transaction has been carried out successfully. Transaction results or events will be done via TransactionEvents callback.

abortQRTransaction

To try to cancel an ongoing QR transaction.

abortQRTransaction()

RETURN VALUE

Boolean

A flag that indicates if the QR transaction has cancelled successfully.

voidTransaction

To void a transaction.

voidTransaction(Activity context, MPOSTransactionParams trxParams, TransactionEvents callback)

PARAMETER

contextActivity

The activity that voids the transaction. Please note that activity is required here instead of plain context.

trxParamsMPOSTransactionParams

The parameters for this void transaction like transaction ID.

callbackTransactionEvents

The callback implementation class for various transactional and card events.

RETURN VALUE

Boolean

A flag that is indicating if the void transaction has started successfully. Please take note that this flag does not indicate the void transaction has carried out successfully. Transaction results or events will be done via TransactionEvents callback.

SAMPLE
MPOSTransactionParams transactionalParams = MPOSTransactionParams.Builder.create() 
	.setMPOSTransactionID(edtTrxID.getText().toString()) 
	.build(); 

 SSMPOSSDK.getInstance().getTransaction().voidTransaction(this, transactionalParams, new MPOSTransaction.TransactionEvents() { 
	@Override 
	public void onTransactionResult(int result, MPOSTransactionOutcome transactionOutcome) { 
		runOnUiThread(new Runnable() { 
			@Override 
			public void run() { 
				if(result == TransactionSuccessful) { 
					// Successful 
				} 
				else { 
					if (transactionOutcome != null) { 
						writeLog(transactionOutcome.getStatusCode() + " - " + transactionOutcome.getStatusMessage()); 
					} 
				} 
			} 
		}); 
	} 
 
	@Override 
	public void onTransactionUIEvent(int event) { 
		runOnUiThread(new Runnable() { 
			@Override 
			public void run() { 
				writeLog("onTransactionUIEvent :: " + event); 
			} 
		}); 
	} 
});

refundTransaction

To refund a transaction.

refundTransaction(Activity context, MPOSTransactionParams trxParams, TransactionEvents callback)

PARAMETER

contextActivity

The activity that refunds the transaction. Please note that activity is required here instead of plain context.

trxParamsMPOSTransactionParams

The parameters for this refund transaction like transaction ID or isCardRequiredForRefund.

callbackTransactionEvents

The callback implementation class for various transactional and card events.

RETURN VALUE

Boolean

A flag that is indicating if the refund transaction has started successfully. Please take note that this flag does not indicate the refund transaction has carried out successfully. Transaction results or events will be done via TransactionEvents callback.

performSettlement

To perform a settlement.

performSettlement(Activity context, MPOSTransactionParams trxParams, TransactionEvents callback)

PARAMETER

contextActivity

The activity that performs the settlement. Please note that activity is required here instead of plain context.

trxParamsMPOSTransactionParams

The parameters object.

callbackTransactionEvents

The callback implementation class for various transactional events.

RETURN VALUE

Boolean

A flag that is indicating if the settlement has started successfully. Please take note that this flag does not indicate the settlement has carried out successfully. Transaction results or events will be done via TransactionEvents callback.

SAMPLE
MPOSTransactionParams transactionalParams = MPOSTransactionParams.Builder.create() 
	.build(); 

 SSMPOSSDK.getInstance().getTransaction().performSettlement(this, transactionalParams, new MPOSTransaction.TransactionEvents() { 
	@Override 
	public void onTransactionResult(int result, MPOSTransactionOutcome transactionOutcome) { 
		runOnUiThread(new Runnable() { 
			@Override 
			public void run() { 
				if(result == TransactionSuccessful) { 
					// Successful 
				} 
				else { 
					if (transactionOutcome != null) { 
						writeLog(transactionOutcome.getStatusCode() + " - " + transactionOutcome.getStatusMessage()); 
					} 
				} 
			} 
		}); 
	} 
 
	@Override 
	public void onTransactionUIEvent(int event) { 
		runOnUiThread(new Runnable() { 
			@Override 
			public void run() { 
				writeLog("onTransactionUIEvent :: " + event); 
			} 
		}); 
	} });

refreshToken

To refresh token.

refreshToken(Activity context, TransactionEvents callback)

PARAMETER

contextActivity

The activity that initiate the refresh token operation. Please note that activity is required here instead of plain context.

callbackTransactionEvents

The callback implementation class for various transactional events.

RETURN VALUE

Boolean

A flag that is indicating if the refresh token operation has started successfully. Please take note that this flag does not indicate the refresh token has carried out successfully. Transaction results or events will be done via TransactionEvents callback.

SAMPLE
SSMPOSSDK.getInstance().getTransaction().refreshToken(this, new MPOSTransaction.TransactionEvents() {
	@Override
	public void onTransactionResult(int result, MPOSTransactionOutcome transactionOutcome) {
		if(result == TransactionSuccessful) {
			// Success
		} else {
			// Failed
		}
	}

	@Override
	public void onTransactionUIEvent(int event) {
		// UI event
		writeLog("onTransactionUIEvent :: " + event);
	}
});

sendReceipt

To send an e-receipt.

sendReceipt(Activity context, MPOSTransactionParams trxParams, TransactionEvents callback)

PARAMETER

contextActivity

The activity that performs send receipt. Please note that activity is required here instead of plain context.

trxParamsMPOSTransactionParams

The parameters for send receipt like email, mobile number.

callbackTransactionEvents

The callback implementation class for various transactional events.

RETURN VALUE

Boolean

A flag that is indicating if the send receipt has started successfully. Please take note that this flag does not indicate the send receipt has carried out successfully. Transaction results or events will be done via TransactionEvents callback.

uploadSignature

To upload signature.

uploadSignature(MPOSTransactionParams trxParams)

PARAMETER

trxParamsMPOSTransactionParams

The parameter for upload signature is signature.

RETURN VALUE

Boolean

A flag that is indicating if the upload signature has started successfully. Please take note that this flag does not indicate the upload signature has carried out successfully. Transaction results or events will be done via TransactionEvents callback.

SAMPLE
MPOSTransactionParams transactionalParams = MPOSTransactionParams.Builder.create()
	.setSignature(base64SignatureString)
	.build();

SSMPOSSDK.getInstance().getTransaction().uploadSignature(transactionalParams);

getTransactionStatus

To get transaction status.

getTransactionStatus(Activity context, MPOSTransactionParams trxParams, TransactionEvents callback)

PARAMETER

contextActivity

The activity that gets the transaction status. Please note that activity is required here instead of plain context.

trxParamsMPOSTransactionParams

The parameters for this get transaction status like transaction ID.

callbackTransactionEvents

The callback implementation class for various transactional events.

RETURN VALUE

Boolean

A flag that is indicating if the get transaction status has started successfully. Please take note that this flag does not indicate the get transaction status has carried out successfully. Transaction results or events will be done via TransactionEvents callback.

SAMPLE
MPOSTransactionParams transactionalParams = MPOSTransactionParams.Builder.create().build(); 

if (trxID.length() > 0) 
{ 
	transactionalParams = MPOSTransactionParams.Builder.create() 
		.setMPOSTransactionID(edtTrxID.getText().toString()) 
		.build(); 
} else if (referenceNo.length() > 0) { 
	transactionalParams = MPOSTransactionParams.Builder.create() 
		.setReferenceNumber(edtRefNo.getText().toString()) 
		.build(); 
} 

 SSMPOSSDK.getInstance().getTransaction().getTransactionStatus(this, transactionalParams, new MPOSTransaction.TransactionEvents() { 
	@Override 
	public void onTransactionResult(int result, MPOSTransactionOutcome transactionOutcome) { 
		runOnUiThread(new Runnable() { 
			@Override 
			public void run() { 
				if(result == TransactionSuccessful) 
				{ 
					if (transactionOutcome.getStatusCode().equals(TRX_STATUS_APPROVED)) 
					{ 
						// approved 
					} 
					else if (transactionOutcome.getStatusCode().equals(TRX_STATUS_SETTLED)) 
					{ 
						// settled 
					} 
 
					String outcome = "Status :: " + transactionOutcome.getStatusCode() + " - " + (mapStatusCode(transactionOutcome.getStatusCode()).length()>0?mapStatusCode(transactionOutcome.getStatusCode()):transactionOutcome.getStatusMessage()) + "\n"; 
					outcome += "Reference no :: " + transactionOutcome.getReferenceNo() + "\n"; 
					outcome += "Amount auth :: " + transactionOutcome.getAmountAuthorized() + "\n"; 
					outcome += "Transaction ID :: " + transactionOutcome.getTransactionID() + "\n"; 
					outcome += "Transaction date :: " + transactionOutcome.getTransactionDate() + "\n"; 
					outcome += "Batch no :: " + transactionOutcome.getBatchNo() + "\n"; 
					outcome += "Approval code :: " + transactionOutcome.getApprovalCode() + "\n"; 
					outcome += "Invoice no :: " + transactionOutcome.getInvoiceNo() + "\n"; 
					outcome += "AID :: " + transactionOutcome.getAid() + "\n"; 
					outcome += "Card type :: " + transactionOutcome.getCardType() + "\n"; 
					outcome += "Application label :: " + transactionOutcome.getApplicationLabel() + "\n"; 
					outcome += "Card number :: " + transactionOutcome.getCardNo() + "\n"; 
					outcome += "Cardholder name :: " + transactionOutcome.getCardHolderName()+ "\n"; 
					outcome += "RRN :: " + transactionOutcome.getRrefNo(); 
				} 
				else 
				{ 
					if(transactionOutcome != null) 
					{ 
						writeLog(transactionOutcome.getStatusCode() + " - " + transactionOutcome.getStatusMessage()); 
					} 
					else 
					{ 
						writeLog("Error ::" + result); 
					} 
				} 
			} 
		}); 
	} 
 
	@Override 
	public void onTransactionUIEvent(int event) { 
		runOnUiThread(new Runnable() { 
			@Override 
			public void run() { 
				writeLog("onTransactionUIEvent :: " + event); 
			} 
		}); 
	} 
});

MPOSTransaction.TransactionEvents

This is a small class that holds various kinds of transaction related events and codes. The event groups within TransactionEvents are TransactionUIEvent, TransactionResult. Below are some callback methods under TransactionEvents.

onTransactionResult

Callback method that will be raised when transaction has finish processes and kernel returns result, together with online host response message.

onTransactionResult(int result, TransactionOutcome transactionOutcome)

PARAMETER

resultint

Result of processing transaction returned by the transaction-processing kernel. For more information about possible result, please refer to Transaction.TransactionEvents.TransactionResult.

transactionOutcomeTransactionOutcome

The transaction outcome object that carries status and details.

onTransactionUIEvent

Callback method that will be raised when there is any kind of UI event that needs to display to user for acknowledgement purpose.

onTransactionUIEvent(int uiEvent)

PARAMETER

uiEventint

The event code that raised the UI event. Please refer to Transaction.TransactionEvents.TransactionUIEvent for more information.

Transaction.TransactionEvents.TransactionUIEvent

This class holds the possible UI events raised by Tap to Pay SDK that may need to show the user.

Data TypeValueDescription
int71PresentCard
Event code indicates reader is ready for transaction.
int72CardPresented
Event code indicates the card is detected by the reader.
int74PresentCardTimeout
Event code indicates present card has timeout.
int23CardReadOk
Event code indicates the contactless card has been processed successfully, can remove card from the terminal.
int24CardReadError
Event code indicates the contactless card processing has failed.
int25CardReadRetry
Event code indicates card read is incomplete and card read retry has been called.
int73Authorising
Event code indicates sending for online authorization.
int70RequestSignature
Event code indicates request for signature.

Transaction.TransactionEvents.TransactionResult

This class holds the possible transaction processing result codes that will be raised with onTransactionResult callback method.

Data TypeValueDescription
int0TransactionSuccessful
Event code indicates transaction has been carried out successfully and the transaction cycle has been completed as well.
int7004TransactionDeclined
Event code indicates the transaction is declined by kernel.
int7005TransactionFailed
Event code indicates the kernel has failed to process the transaction.
int7006TransactionNoAppError
Event code indicates the card tapped does not have any schemes in it.
int7007TransactionFailedAllowFallback
Event code indicates the transaction has failed but allowing fallback mechanism. Please handle this error the same way as how TransactionFailed is handled.
int7008TransactionCardExpired
Event code indicates the transaction has failed due to the card tapped has expired.
int7020TransactionOnlineFailed
Event code indicates the transaction has failed due to online host rejection.
int7024TransactionCancel
Event code indicates the transaction has been cancelled intentionally by the user.
int7028TransactionTimeout
Event code indicates the transaction has failed due to timer that starts counting since transaction start has elapsed.
int7054TransactionRequireCDCVM
Event code indicates that CDCVM is required, advise customer to see phone for instructions.
int7056TransactionTryAgain
Event code indicates the Tap to Pay SDK has failed to communicate with the card tapped. This is most likely happened when the card has moved away in the midst of transaction processing.
int7059TransactionPinNotSupported
Event code indicates the transaction has failed due to transaction amount above CVM limit and PIN is not supported for the particular card type.

TransactionOutcome

This class holds the transaction outcome that will be raised with onTransactionResult callback method.

Data TypeFieldMandatoryDescription
StringstatusCodeYStatus code of the transaction.
StringstatusMessageYStatus message of the transaction.
Sales Only
StringapprovalCodeYApproval code from Host.
StringtransactionIDYTransaction ID from MPOS server, to be used for SendReceipt or Void.
StringcardNoYMasked PAN number.
StringcardTypeYCard type.
0 – Visa
1 – Mastercard
2 – AMEX
3 – JCB
7 – UnionPay
10 – Diners
11 – TPN
22 – VCCS(NAPAS)
23 – Discover
StringcardHolderNameNCard holder name from EMV data.
StringaidYAID from EMV data.
StringtransactionDateYTransaction Date of the transaction.
StringtransactionTimeYTransaction Time of the transaction.
StringacquirerIDNAcquirer ID of the transaction.
StringapplicationCryptogramNApplication Cryptogram of the transaction.
StringterminalVerificationResultsNTVR of the transaction.
StringtransactionStatusInfoNTSI of the transaction.
StringmerchantIdentifierNMID of the transaction.
StringterminalIdentifierNTID of the transaction.
StringinvoiceNoNInvoice No of the transaction.
StringcontactlessCVMTypeNContactless CVM Type of the transaction.
StringrrefNoNRRN of the transaction.
StringtransactionCertNTC of the transaction.
StringmerchantCategoryCodeNMCC of the transaction.
StringreceiptUrlNURL for e-receipt of the transaction.
StringtransactionDateTimeNFull date time of the transaction.
StringreferenceNoNUnique reference no of the transaction.
StringtraceNoNTrace No of the transaction.
QR Sales Only
StringqrIDYID of the QR transaction.
StringqrDataYQR content that used to generate QR code.
BitmapqrCodeYQR code image of the requested QR type in Bitmap form.

MPOSTransactionParams.Builder

This is the builder class for MPOSTransactionParams.

setAmount

Setting the amount value for the transaction. The amount should be in String format, and it should only be numeric form. Please do not include the decimal point while setting the amount.

For example, if the amount is 5.99, please pass in as '599' in String. If it is 599.00, please pass in '59900'.

For sale and refund transactions

setAmount(String amount)

PARAMETER

amountString

The transaction amount.

RETURN VALUE

MPOSTransactionParams.Builder

The current object of the builder class of MPOSTransactionParams.

setCardRequiredForRefund

Indicator for refund transaction type.

For refund transaction

setCardRequiredForRefund(boolean cardRequiredForRefund)

PARAMETER

cardRequiredForRefundboolean

The refund indicator.

RETURN VALUE

MPOSTransactionParams.Builder

The current object of the builder class of MPOSTransactionParams.

setMPOSTransactionID

Setting the sales/refund transaction ID value for the Void transaction, returned from MPOS server during Sale/Refund transaction.

For void transaction

setMPOSTransactionID(String mposTransactionID)

PARAMETER

mposTransactionIDString

The transaction ID from MPOS server.

RETURN VALUE

MPOSTransactionParams.Builder

The current object of the builder class of MPOSTransactionParams.

setQRType

QR type for QR transaction.

For QR sales

setQRType(QRType qrType)

PARAMETER

qrTypeQRType

The QR type.

Supported QR Types:

  • DuitNow QR
  • AliPay
  • Wechat
  • TouchNGo
  • PromptPay
  • Fasspay
  • Boost
  • Maybank
  • UnionPay
  • MCash
  • GrabPay
  • WechatPayCN
  • ShopeePay
  • NETSPay
  • Aeon
  • JoyWallet
  • AAPocket
  • Pay2Me
  • SakuPay
  • ATLAS

RETURN VALUE

MPOSTransactionParams.Builder

The current object of the builder class of MPOSTransactionParams.