Getnet DocsGetnet Docs

Refund a Payment

This guide shows you how to reverse a previously completed transaction using the Refund deeplink. Partial refunds are supported when the amount is less than the original transaction.

Before you begin

Before initiating a refund, ensure you have:

  • The authorization code (AUT) and transaction date from the original successful payment response.
  • The exact or partial amount to be reversed.
  • Verified the terminal is ready via getnet://payment/v1/polling.

Step 1: Configure the refund Intent

To initiate the reversal, use the getnet://payment/v1/refund URI.

ParameterTypeRequiredDescription
authorizationCodeStringYesOriginal transaction code found as “AUT” on the receipt.
transactionDateStringYesDate of the original transaction in dd/MM/yyyy format.
amountStringYesValue to be reversed; if less than the original, a partial refund is performed.
refundTypeStringNoType of refund: "1" sale withdrawal, "2" sale, "3" withdrawal.
skipConfirmationStringNoSet to "true" to skip the amount confirmation screen.
skipReceiptStringNoDefines whether the client receipt is printed.
allowPrintCurrentTransactionStringNoSet to "false" to receive receipt data as automationSlip instead of printing.

The authorization code and transaction date are returned in the onActivityResult response when you process a payment. Store these values after each successful transaction so you can use them for refunds later.

Partial refunds: If the amount is less than the original transaction amount, a partial refund is processed. You can perform multiple refunds on the same original transaction until the total amount is reached.

Here’s how to configure and send the refund intent:

private val REFUND_REQUEST_CODE = 2001

fun processRefund(authCode: String, transactionDate: String, amount: String) {
    val intent = Intent(Intent.ACTION_VIEW, Uri.parse("getnet://payment/v1/refund")).apply {
        putExtra("authorizationCode", authCode)
        putExtra("transactionDate", transactionDate)
        putExtra("amount", amount)
        putExtra("refundType", "2")
    }
    startActivityForResult(intent, REFUND_REQUEST_CODE)
}

Step 2: Handle the response

The terminal processes the reversal and returns the result to your activity. The response includes result, resultDetails, authorizationCode, commerceCode, amount, gmtDateTime, callerId, nsuLastSuccesfullMessage, refundTransactionDate, refundOriginTerminal, and automationSlip.

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    if (requestCode == REFUND_REQUEST_CODE && resultCode == RESULT_OK) {
        val extras = data?.extras
        val result = extras?.getString("result")

        if (result == "0") {
            // Refund approved
        } else {
            val details = extras?.getString("resultDetails")
            // Handle error
        }
    }
}

Next steps