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.
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:
sdk.capture(
transactionId = transactionId,
amount = 10875
)
Capture with Updated Breakdown
Include the final breakdown when the tip or surcharge changed after the preauth:
iOS:
let finalBreakdown = PaymentBreakdown(
subtotal: 10000,
taxRate: 0.0875,
taxAmount: 875,
tipAmount: 3000, // customer added a $30 tip
tipType: .fixed,
surcharge: PaymentBreakdown.Surcharge(
amount: 486, // 3.5% of (10000 + 875 + 3000) = 486
percentage: 0.035
)
)
let response = try await KoardMerchantSDK.shared.capture(
transactionId: transactionId,
amount: 14361, // 10000 + 875 + 3000 + 486
breakdown: finalBreakdown
)
Android:
val finalBreakdown = PaymentBreakdown(
subtotal = 10000,
taxRate = 0.0875,
taxAmount = 875,
tipAmount = 3000,
tipType = "fixed",
surcharge = Surcharge(
amount = 486,
percentage = 0.035
)
)
sdk.capture(
transactionId = transactionId,
amount = 14361,
breakdown = finalBreakdown
)
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:
sdk.capture(
transactionId = transactionId,
amount = 8000
)
The remaining hold amount is automatically released back to the cardholder.
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 |
String? |
No | Idempotency key |
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
