Transaction request
For transaction request, your app just need to pass the below data in the intent extra
API_KEY
&API_TOKEN
- for the credential of the paymentECR_TRANSACTION_REQUEST
- the transaction details, including the amount, preferred payment instrument- (Optional)
ENFORCE_FETCH_CONFIG
- to force the SoftPOS app to fetch the latest config from the backend, might incur a few seconds depending on the network condition
TransactionRequest data
To start a new transaction, create the TransactionRequest
and put it in the intent extra.
data class TransactionRequest(
val requestAmount: BigDecimal? = null,
val tranType: TranType? = null,
val preferredInstrument: PreferredInstrument? = null,
/**
* The unique ID from the POS
*/
val messageId: String,
/**
* Conditional required for void, auth complete
*/
val tranId: String? = null,
/**
* Optional field for merchant remarks
*/
val description: String? = null
) : Serializable
For all supported TranType
& PreferredInstrument
, refer to the data models
Start a new sale
Sale transactionRequest
val saleRequest = TransactionRequest(
messageId = UUID.randomUUID().toString(),
tranType = "SALE",
requestAmount = BigDecimal(20.00),
preferredInstrument = CARD
)
To start a new SALE,
Intent("com.spectratech.soepay.action.payment")
.apply {
putExtra("API_KEY", dummyCredential.apiKey)
putExtra("API_TOKEN", dummyCredential.apiToken)
putExtra("ECR_TRANSACTION_REQUEST", saleRequest)
if (binding.switchEnforceFetch.isChecked)
putExtra("ENFORCE_FETCH_CONFIG", true)
}
.also {
try {
paymentLauncher.launch(it)
} catch (ex: Exception) {
Toast.makeText(this@MainActivity, "Cannot start act", Toast.LENGTH_SHORT).show()
}
}
Sale response data
{
"cancelable": true,
"cardData": {
"aid": "A0000000041010",
"appName": "Debit Mastercard",
"approvalCode": "123456",
"mid": "000000000000001",
"tc": "85230B910BDA0B37",
"tid": "000001",
"tsi": "0000",
"tvr": "0000000000"
},
"createById": "0396857704d731a58059e3771867085f2a4dd502",
"createByName": "dev",
"createTime": "2021-08-20T04:44:52+0000",
"entryMode": "CONTACTLESS",
"lastUpdateTime": "2021-08-20T04:44:53+0000",
"messageId": "ea4e27d353055bb5762aec5e4a5f212b424022fb",
"payment": {
"adjustable": false,
"baseAmount": 20,
"createTime": "2021-08-20T04:44:51+0000",
"lastUpdateTime": "2021-08-20T04:44:53+0000",
"organize": {
"address": "ADDR",
"name": "Public POS Integration Test"
},
"payer": "••••7128",
"paymentId": "1009bb238fee88080333d0f42615f170f66efb26",
"paymentMethod": "MASTER",
"paymentTrace": 42175,
"...": "..."
},
"processorReference": "f663c90613912db73303877f22d9c12c",
"requireSignature": false,
"totalAmount": 20,
"trace": 43473,
"tranId": "ff6f03d59fb6ab00e94e43c7408df161fbf687e0",
"tranStatus": "APPROVED",
"tranType": "SALE",
"...": "..."
}
Void a transaction
To cancel/ void a transaction before the settlement process, you can retrieve the tranId
with the enquiry API and then put it in the Intent
extra.
Void transactionRequest
val voidRequest = TransactionRequest(
messageId = UUID.randomUUID().toString(),
tranType = "VOID",
tranId = "ff6f03d59fb6ab00e94e43c7408df161fbf687e0",
)