Getnet DocsGetnet Docs

Create a Pre-authorized Payment

This guide walks you through processing a pre-authorization transaction using the Getnet Payment App. Pre-authorization temporarily holds funds on a customer’s credit card for a future capture, commonly used for hotel reservations or car rentals where the final amount may vary.

Before you begin

Before following the steps, you need to:

  • Getnet Payment App installed on the terminal.
  • Knowledge of installment plan codes, if applicable.

How it works

All pre-authorization actions use the getnet://payment/v1/pre-auth URI. The operation parameter selects the action:

operationActionDescription
"0"CreateReserve funds on the card.
"1"ModifyUpdate an existing pre-authorization.
"2"RemoveCancel a pre-authorization.
"3"ConfirmCapture the reserved funds.
"4"RetrieveList pending pre-authorizations.

The create operation returns an authorizationRefCode. This value is the pre-authorization identifier. You send it back as reservation_id to modify, confirm, or remove the pre-authorization. Store it after every create.

Step 1: Create a pre-authorization

To reserve an amount on the customer’s card, send an Intent with operation set to "0".

Request Parameters

ParameterDescriptionRequired
operationSet to "0" to create the pre-authorization.Yes
originalAmountValue in local currency to perform the transaction.Yes
amountValue to reserve. The last two digits are the decimal portion (e.g., "10000" = $100.00).No
installmentsNumber of installments for the credit transaction.No
plan_idInstallment plan to be used. See Installment Rules.No
interestWhether the plan includes interest (true) or is interest-free (false).No
operationMode"0" for manual (terminal calculates) or "1" for calculated (app calculates).No
skipReceiptSet to "true" to bypass the customer receipt screen.No
skipConfirmationSet to "true" to skip the installment detail confirmation screen.No
callerIdUnique identifier to correlate request with response.No
allowPrintCurrentTransactionSet to "false" to receive receipt data as automationSlip.No

The following code block shows how to create a pre-authorization:

private val REQUEST_CODE = 1001

private fun createPreAuth() {
    val intent = Intent(Intent.ACTION_VIEW, Uri.parse("getnet://payment/v1/pre-auth"))

    intent.putExtra("operation", "0") // 0 = create
    intent.putExtra("amount", "10000") // $100.00
    intent.putExtra("originalAmount", "10000")
    intent.putExtra("installments", "1")
    intent.putExtra("plan_id", "plan_emisor")
    intent.putExtra("operationMode", "0")
    intent.putExtra("skipReceipt", "true")

    startActivityForResult(intent, REQUEST_CODE)
}

Response Parameters

ParameterDescriptionRequired
resultStatus of the transaction; "0" indicates success.Yes
resultDetailsAdditional information when the transaction fails.No
amountValue processed for the pre-authorization hold.Yes
authorizationRefCodePre-authorization identifier. Store it — you send it as reservation_id to modify, confirm, or remove the pre-authorization.No
inputTypeHow the card was read (chip, contactless, or magnetic stripe).Yes
authorizationCodeTransaction authorization code from the issuer.No
nsuGetnet transaction authorization code for the terminal.No
cardLastDigitsLast 4 digits of the card used.No
brandCard brand (e.g., Visa, Mastercard).No
gmtDateTimeTimestamp of the transaction in UTC 0 (MMDDhhmmss).No
automationSlipJSON receipt data when allowPrintCurrentTransaction is "false".No

Example of handling the create response:

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)

    if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
        val extras = data?.extras
        val result = extras?.getString("result")

        if (result == "0") {
            // SUCCESS: store the pre-authorization identifier
            val reservationId = extras?.getString("authorizationRefCode")
            val amount = extras?.getString("amount")

            // Store authorizationRefCode - you send it as reservation_id later
            saveReservationId(reservationId)
        } else {
            val errorDetails = extras?.getString("resultDetails")
            Log.e("PreAuth", "Pre-authorization failed: $errorDetails (Code: $result)")
        }
    }
}

Store the authorizationRefCode from the response. This identifier is required to confirm, modify, or remove the pre-authorization. If it is not provided in subsequent operations, the funds are automatically released after the hold period expires.

Step 2: Confirm a pre-authorization

After the service or product is delivered, confirm the pre-authorization to convert the temporary hold into a finalized payment. This captures the funds and completes the transaction.

Request Parameters

ParameterDescriptionRequired
operationSet to "3" to capture the pre-authorized funds.Yes
reservation_idThe authorizationRefCode received in Step 1.Yes
amountUpdated final amount to capture. If omitted, the app uses the original held value.No
private fun confirmPreAuth(reservationId: String, finalAmount: String? = null) {
    val intent = Intent(Intent.ACTION_VIEW, Uri.parse("getnet://payment/v1/pre-auth"))

    intent.putExtra("operation", "3") // 3 = confirm
    intent.putExtra("reservation_id", reservationId)

    finalAmount?.let { intent.putExtra("amount", it) }

    startActivityForResult(intent, REQUEST_CODE)
}

Verify success by checking that result equals "0" in onActivityResult.

Modify a pre-authorization

To update the held amount before capture, send operation set to "1" with the reservation_id. See Modify a Payment for the full flow.

Remove a pre-authorization

To cancel a pre-authorization and release the held funds, send operation set to "2" with the reservation_id.

private fun removePreAuth(reservationId: String) {
    val intent = Intent(Intent.ACTION_VIEW, Uri.parse("getnet://payment/v1/pre-auth"))

    intent.putExtra("operation", "2") // 2 = remove
    intent.putExtra("reservation_id", reservationId)

    startActivityForResult(intent, REQUEST_CODE)
}

Retrieve pending pre-authorizations

To list pending pre-authorizations, send operation set to "4". You can narrow the results with the filter parameters filterReservationId, filterInitialDate, filterFinalDate, filterAuthorizationCode, filterCardLastDigits, and filterAllowedBrands. The response returns a pendingAuthorizations list of up to the 30 most recent pending pre-authorizations. See Deeplink Parameters.

Next steps