Unreferenced Refund
An unreferenced refund is a card-present credit that is not tied to any original sale. Instead of pointing at a previous payment, you start a brand new transaction and the customer presents their card at the terminal to receive the money back.
Use this when you need to return funds but don't have, or don't want to use, the original payment's transaction reference. If you do have the original payment, prefer a Referenced Refund, which links the credit back to the initial sale for cleaner reconciliation.
Unreferenced refunds is currently not open to new applications. You may implement and test but not board any live customers.
Referenced refunds are strongly recommended wherever possible.
An unreferenced refund sends a credit to a card without any link to a prior payment. Because there is no original transaction to validate against, these refunds are subject to additional fraud screening. As a result:
- Some merchants may not be eligible to process unreferenced refunds at all.
- An individual unreferenced refund may be declined even where the same refund would succeed as a referenced refund.
- Eligibility cannot be reliably predicted, so building exclusively on unreferenced refunds risks unexplained refusals for merchants.
Use unreferenced refunds only where the originalgateway_payment_idis genuinely unavailable.
Make an unreferenced refund
Call makeUnreferencedRefund on your transactionsApi instance. It reuses the same state machine as makePayment, so it returns a payment subscription rather than the TeyaRefundResultListener flow used by referenced refunds.
let transactionId = UUID().uuidString // Or pass an identifier you already use; must be unique within the linked store
let amountToRefund: Int32 = 100 // Amount in the smallest currency unit (e.g., cents)
let currency = "GBP" // ISO 4217 currency code (e.g., "GBP", "EUR")
let refundSubscription = teyaPosLinkSDK.transactionsApi.makeUnreferencedRefund(
transactionId: transactionId,
amount: amountToRefund,
currency: currency
)
Unreferenced refunds are not available for tab, or Pay at Table, payments.
Subscribe to the refund status
Since makeUnreferencedRefund returns a payment subscription, you track its progress exactly like a payment. Subscribe a TeyaPaymentStateChangeListener and read the same TeyaPaymentStateDetails states described in Make Payment, for example In_Progress, Successful and Processing_Failed.
private class RefundStateListener: TeyaPaymentStateChangeListener {
func onPaymentStateChanged(state: TeyaPaymentStateDetails) {
print("Refund state changed: \(state)")
// Update your UI based on state.state and state.isFinal
}
}
refundSubscription.subscribe(listener: RefundStateListener())
Transaction type
The payment subscription exposes a transactionType property so you can tell, at runtime, whether it tracks a payment or a refund.
| Value | Description |
|---|---|
payment |
Money charged to the customer. |
refund |
Money returned to the customer. |
For an unreferenced refund, refundSubscription.transactionType is TeyaTransactionType.refund. The id of the created refund is available on TeyaPaymentStateDetails.gatewayRefundId once it reaches the Successful state.
Re-attach to a refund in progress
If your app loses track of a refund it started, you can re-attach to it with subscribeToPayment and the ePOS transactionId you started it with - see Subscribe to an existing payment.
Contact us at partnersupport@teya.com to have unreferenced refunds enabled for your account. Until the feature is activated, the refund reaches a failed state whose reason is TeyaPaymentStateReason.featureNotActivatedUnreferencedRefunds. You can read state.reason on the latest TeyaPaymentStateDetails.