Refund

Last updated: 2026-03-13

INTENT
se.westpay.softpos.REFUND

Initiate a refund transaction through WestPay SoftPOS

Request Body

amountstringrequired

Refund amount using a comma as the decimal separator, e.g. 50,00 for 50.00. Must not exceed the original transaction amount.

currencyIdintrequired

ISO 4217 numeric currency code, e.g. 752 for SEK, 978 for EUR.

HTTP Status Code Summary

CodeDescription
RESULT_OKThe operation completed. Check isSuccess in the response extras to determine if the refund was approved.
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 data = result.data
6        val success = data?.getBooleanExtra("isSuccess", false) ?: false
7        if (success) {
8            val transactionId = data?.getStringExtra("transactionId")
9            // Handle successful refund
10        } else {
11            val error = data?.getStringExtra("error")
12            val denialReason = data?.getStringExtra("denialReason")
13            // Handle failure
14        }
15    } else {
16        val error = result.data?.getStringExtra("error")
17            ?: result.data?.getStringExtra("Error")
18        // Handle cancellation
19    }
20}
21
22fun initiateRefund(amount: String, currencyId: Int) {
23    val intent = Intent("se.westpay.softpos.REFUND").apply {
24        putExtra("amount", amount)           // e.g. "50,00"
25        putExtra("currencyId", currencyId)   // e.g. 752 for SEK
26        addCategory(Intent.CATEGORY_DEFAULT)
27    }
28    if (intent.resolveActivity(packageManager) != null) {
29        resultLauncher.launch(intent)
30    } else {
31        showError("WestPay SoftPOS is not installed")
32    }
33}
Response
Response
1{
2  "isSuccess": true,
3  "amount": "50,00",
4  "currencyId": "752",
5  "transactionId": "TX789012",
6  "terminalId": "T001",
7  "acqRefNumber": 987654321,
8  "cardType": "Visa",
9  "maskedCardPan": "****1234",
10  "type": "Refund",
11  "status": "Approved",
12  "time": "2025-01-06T11:00:00",
13  "denialReason": "None",
14  "error": "None",
15  "receiptDetails": "{...}"
16}