Transaction History

Last updated: 2026-03-13

INTENT
se.westpay.softpos.VIEW_HISTORY

Retrieve a list of transactions for a date range from WestPay SoftPOS

Request Body

startDatestringoptional

Start of the date range. Format: yyyy-MM-dd, e.g. 2025-01-01.

endDatestringoptional

End of the date range. Format: yyyy-MM-dd, e.g. 2025-01-31.

HTTP Status Code Summary

CodeDescription
RESULT_OKThe operation completed. Check isSuccess and parse the txnHistoryResponse extra.
RESULT_CANCELEDThe operation was cancelled or could not complete. Check the error / Error extra for the reason.
Request
kotlin
1private val resultLauncher = registerForActivityResult(
2    ActivityResultContracts.StartActivityForResult()
3) { result ->
4    if (result.resultCode == Activity.RESULT_OK) {
5        val historyJson = result.data?.getStringExtra("txnHistoryResponse")
6        try {
7            val history = Gson().fromJson(historyJson, TransactionHistoryResponse::class.java)
8            history?.transactionList?.forEach { transaction ->
9                Log.d("History", "Transaction: ${transaction.transactionDateTime}")
10            }
11            history?.transactionSummary?.let { summary ->
12                Log.d("Summary", "Total Purchases: ${summary.totalPurchaseAmount}")
13                Log.d("Summary", "Total Refunds: ${summary.totalRefundAmount}")
14            }
15        } catch (e: Exception) {
16            Log.e("SoftPOS", "Error parsing transaction history", e)
17        }
18    }
19}
20
21fun getTransactionHistory(startDate: String, endDate: String) {
22    val intent = Intent("se.westpay.softpos.VIEW_HISTORY").apply {
23        putExtra("startDate", startDate)   // e.g. "2025-01-01"
24        putExtra("endDate", endDate)       // e.g. "2025-01-31"
25        addCategory(Intent.CATEGORY_DEFAULT)
26    }
27    if (intent.resolveActivity(packageManager) != null) {
28        resultLauncher.launch(intent)
29    } else {
30        showError("WestPay SoftPOS is not installed")
31    }
32}
33
34// Get today's transactions
35fun getTodaysHistory() {
36    val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
37    val today = dateFormat.format(Date())
38    getTransactionHistory(today, today)
39}
Response
Response
1{
2  "isSuccess": true,
3  "txnHistoryResponse": "{\"status\":\"OK\",\"transactionList\":[{\"acqRef\":123456789,\"terminalId\":\"T001\",\"transactionDateTime\":\"2025-01-06T10:30:00\",\"formattedAmount\":\"100,50 SEK\",\"card\":\"****1234\",\"paymentNetwork\":\"Visa\",\"txnStatus\":\"Approved\",\"transactionType\":\"Purchase\"}],\"transactionSummary\":{\"totalPurchaseAmount\":100.50,\"totalRefundAmount\":0.00}}"
4}