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 original gateway_payment_id is genuinely unavailable.

Make an unreferenced refund

Call the makeUnreferencedRefund function on the transactionsApi. It reuses the same state machine as makePayment, so it returns a PaymentStateSubscription rather than the RefundResultSubscription used by referenced refunds. In the coroutines API it likewise returns a PaymentHandle.

Kotlin (callbacks)

val refundSubscription = teyaPosLinkSDK.transactionsApi.makeUnreferencedRefund(
    transactionId = UUID.randomUUID().toString(), // or pass whatever identifier you already have for this refund. Must be unique within the linked store.
    amount = amountToRefund, // The amount to refund, in the smallest unit of the currency (e.g., cents).
    currency = "GBP" // The ISO 4217 currency code (e.g., "GBP", "EUR").
)

Unreferenced refunds are not available for tab, or Pay at Table, payments.

Subscribe to the refund status

Since makeUnreferencedRefund returns a PaymentStateSubscription, you track its progress exactly like a payment. Subscribe a PaymentStateChangeListener and read the same PaymentStateDetails states described in Make Payment, for example In_Progress, Successful and Processing_Failed.

Kotlin (callbacks)

val listener = object : PaymentStateSubscription.PaymentStateChangeListener {
    override fun onPaymentStateChanged(state: PaymentStateSubscription.PaymentStateDetails) {
        println("new state = $state, is it a final state = $state.isFinal")
    }
}
refundSubscription.subscribe(listener)

Transaction type

The PaymentStateSubscription exposes a transactionType property so you can tell, at runtime, whether it tracks a payment or a refund. The coroutines API's PaymentHandle exposes the same property.

public enum class TransactionType {
    Payment, // Money charged to the customer.
    Refund,  // Money returned to the customer.
}

For an unreferenced refund, refundSubscription.transactionType (or refundHandle.transactionType) is TransactionType.Refund. The id of the created refund is available on PaymentStateDetails.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.

Availability

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 PaymentStateReason.FeatureNotActivatedUnreferencedRefunds. You can read state.reason on the latest PaymentStateDetails.