Getnet DocsGetnet Docs

Modify a Payment

This guide walks you through modifying the amount of an existing pre-authorized hold using the Getnet Payment App. You can adjust the amount of a previously authorized credit card hold without finalizing the sale. This is commonly used in scenarios like hotel check-ins or car rentals where the final total may change before the guest checks out.

Before you begin

Before following the steps, you need to:

  • Getnet Payment App installed on the terminal.
  • The authorizationRefCode returned when you created the pre-authorization. You send it back as reservation_id.
  • The new amount in minor units (e.g., “10000” for $100.00).

You can only modify pre-authorizations that have not yet been confirmed (captured) or removed.

Modify the pre-authorization amount

To update the hold amount on a customer’s credit card, create an Intent with the modify operation (operation = "1") and include the pre-authorization identifier.

The table below lists the parameters you send in the Intent:

ParameterDescriptionRequired
operationSet to "1" to modify the pre-authorization amount.Yes
reservation_idThe authorizationRefCode received when creating the pre-authorization.Yes
amountThe new hold amount in minor units (e.g., “15000” for $150.00).Yes
originalAmountValue in local currency to perform the transaction.Yes
callerIdIdentifier to correlate request with response.No

The following code block shows an example of how to modify a pre-authorization:

private val PREAUTH_UPDATE_CODE = 1002

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

    // Operation type
    intent.putExtra("operation", "1") // 1 = modify

    // Pre-authorization identifier
    intent.putExtra("reservation_id", reservationId)

    // New total amount
    intent.putExtra("amount", "15000") // $150.00
    intent.putExtra("originalAmount", "15000")

    intent.putExtra("callerId", "req_update_001")

    startActivityForResult(intent, PREAUTH_UPDATE_CODE)
}

After the modification is processed, the Getnet Payment App returns the result to your application via onActivityResult.

The following code block shows an example of handling the response:

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

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

        if (result == "0") {
            // SUCCESS: Update successful
            val newAmount = extras?.getString("amount")
            Log.d("PreAuth", "Pre-authorization modified successfully")
            Log.d("PreAuth", "New amount: $newAmount")

            // Sync your local database with the new amount
        } else {
            // FAILURE: Handle error
            val errorDetails = extras?.getString("resultDetails")
            Log.e("PreAuth", "Modification failed: $errorDetails (Code: $result)")
        }
    }
}

Next steps