Capture
Capture finalizes a previously authorized (preauth) transaction. You can capture at the original amount, a lower amount (partial capture), or with an updated breakdown that includes tip or surcharge.
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.
Prerequisites
- An existing preauth transaction ID
- Transaction must be in an authorized (uncaptured) state
Full Capture
iOS:
let response = try await KoardMerchantSDK.shared.capture(
transactionId: transactionId,
amount: 10875
)
Android:
val transaction = sdk.capture(
transactionId = transactionId,
amount = 10875
).getOrThrow()
Capture with Updated Breakdown
Include the final breakdown when the tip or surcharge changed after the preauth. If the final amount exceeds the current authorization, obtain any required incremental authorization first. Each surcharge specifies an amount or a percentage, never both:
iOS:
let finalBreakdown = PaymentBreakdown(
subtotal: 10000,
taxRate: 8.75,
taxAmount: 875,
tipAmount: 3000, // customer added a $30 tip
tipType: .fixed,
surcharge: PaymentBreakdown.Surcharge(
amount: 486 // 3.5% of (10000 + 875 + 3000) = 486
)
)
let response = try await KoardMerchantSDK.shared.capture(
transactionId: transactionId,
amount: 14361, // 10000 + 875 + 3000 + 486
breakdown: finalBreakdown
)
Android:
val finalBreakdown = PaymentBreakdown(
subtotal = 10000,
taxRate = 8.75,
taxAmount = 875,
tipAmount = 3000,
tipType = "fixed",
surcharge = Surcharge(
amount = 486
)
)
sdk.capture(
transactionId = transactionId,
amount = 14361,
breakdown = finalBreakdown
).getOrThrow()
Partial Capture
Capture at a lower amount than the original hold:
iOS:
let response = try await KoardMerchantSDK.shared.capture(
transactionId: transactionId,
amount: 8000 // capture $80 of a $108.75 hold
)
Android:
val transaction = sdk.capture(
transactionId = transactionId,
amount = 8000
).getOrThrow()
Any remaining authorization hold is released according to the processor and issuer rules; do not promise an immediate release.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
transactionId |
String |
Yes | The preauth transaction to capture |
amount |
Int? |
No | Capture amount in minor units. Defaults to the original preauth amount. |
breakdown |
PaymentBreakdown? |
No | Updated breakdown with final tip/surcharge |
eventId (iOS only in the current releases) |
String? |
No | Idempotency key |
Result
This operation returns the transaction result. The Transaction Result lists the fields you can read from it.
See Also
- Preauth: Place a hold before capturing
- Incremental Auth: Increase the hold before capture
- Tip Adjust: Update tip before capture
- Surcharging: Include surcharge in capture breakdown

