Reverse (Void)

A reverse voids a transaction before settlement, requesting release of the authorization hold according to the processor and issuer rules. Use it to cancel a sale or preauth that hasn't settled yet.

For returning funds after settlement, see Refund.

Persist a separate eventId with your order before each operation below, and pass that saved value to the SDK. On a timeout or lost response, reconcile that ID instead of generating a new one. See Idempotency and Outcome Recovery.

Run Android reference operations from withContext(Dispatchers.IO). The examples unwrap Result with getOrThrow(); handle thrown errors at the UI boundary. Inspect the returned transaction status and operation amounts before displaying success. See the Android operation helpers.

Full Reverse

iOS:

let response = try await KoardMerchantSDK.shared.reverse(
    transactionId: transactionId,
    eventId: eventId
)

Android:

val transaction = sdk.reverse(
    transactionId = transactionId,
    eventId = eventId
).getOrThrow()

Partial Reverse

Reduce the authorized amount without voiding the entire transaction:

iOS:

let response = try await KoardMerchantSDK.shared.reverse(
    transactionId: transactionId,
    amount: 5000,             // reduce hold by $50
    eventId: eventId
)

Android:

val transaction = sdk.reverse(
    transactionId = transactionId,
    amount = 5000,
    eventId = eventId
).getOrThrow()

Surcharge Handling

When reversing a surcharged transaction, the surcharge is handled according to the processor's reversal rules. Verify the returned reversed amount, especially for partial reversals.

When to Use Reverse vs. Refund

Reverse Refund
Timing Before settlement After settlement
Availability Hold release timing depends on the issuer Credit timing depends on the processor and issuer
Surcharge Verify the returned reversal amount Verify the processor's refund treatment
Use case Cancel, customer changed mind Post-settlement return

Parameters

Parameter Type Required Description
transactionId String Yes Transaction to reverse
amount Int? No Partial reverse amount in minor units. Omit for full void.
eventId String? No Idempotency key

Result

This operation returns the transaction result. The Transaction Result lists the fields you can read from it.

See Also

  • Refund: Return funds after settlement
  • Sale: Original payment
  • Preauth: Authorization hold