Refund
A refund returns funds to the cardholder after settlement. Use it for post-settlement returns, partial returns, or customer disputes.
For voiding a transaction before settlement, see Reverse.
Full Refund
iOS:
let response = try await KoardMerchantSDK.shared.refund(
transactionId: transactionId,
amount: 12875,
eventId: UUID().uuidString
)
Android:
sdk.refund(
transactionId = transactionId,
amount = 12875,
eventId = UUID.randomUUID().toString()
)
Partial Refund
Refund a portion of the original transaction:
iOS:
let response = try await KoardMerchantSDK.shared.refund(
transactionId: transactionId,
amount: 5000, // refund $50 of the original
eventId: UUID().uuidString
)
Android:
sdk.refund(
transactionId = transactionId,
amount = 5000,
eventId = UUID.randomUUID().toString()
)
Tap-Based Refund (iOS)
For card-present refunds where the customer taps their card:
let response = try await KoardMerchantSDK.shared.refund(
transactionId: transactionId,
amount: 12875,
tapBasedRefund: true,
eventId: UUID().uuidString
)
Tap-based refunds require the card reader to be prepared. The customer taps their card to confirm the refund.
Surcharge Handling
When refunding a surcharged transaction, the surcharge is prorated automatically by the processor. You do not need to pass a breakdown or calculate the surcharge portion—just pass the refund amount and the processor handles the rest.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
transactionId |
String |
Yes | Original transaction to refund |
amount |
Int |
Yes | Refund amount in minor units |
eventId |
String? |
No | Idempotency key |
tapBasedRefund |
Bool? |
No | iOS only—require card tap to confirm refund |
activity |
Activity |
Yes (Android) | Android activity for tap-based refunds |
See Also
- Reverse — Void before settlement
- Sale — Original payment
- Payment Lifecycle — End-to-end flow
