TransactionResponse class

Result of a transaction request (payment, refund, pre-auth, capture, void, AVT) or of a transaction-status (v2) query.

A response object is returned even when a payment is declined: declines are signalled in the body, not by an exception. Exceptions are only thrown for HTTP/transport errors.

Careful — responseCode != "0" is NOT the test for a decline. That reading is what caused the double charge of 2026-08-24: noStatementCode (9027) is a code other than "0" and yet says nothing at all — it stands for "still running" just as much as for "aborted" or "never seen". Reading it as a decline reports "nothing was charged, safe to retry" for a payment that is running right now.

A decline is a conclusive code other than "0". Use isConclusive to ask whether this response settles anything, and only then isApproved to ask which way; isNoStatement names the gap. A response that is not conclusive is a reason to keep clarifying, never an outcome.

Zweite Lehre, am 27.08.2026: isConclusive darf keine Negativliste sein, die sich als Positivliste ausgibt. Bis dahin galt "jeder Code ausser null und noStatementCode ist schluessig" -- das unterstellt, wir kennten bereits alle Codes, die KEINE Aussage sind. Gemessen an einem hobex-HPS (TID 3600335, HPS 1.10.0, Firmware 7.3.6): die Statusabfrage antwortete auf eine nicht rein numerische Kennung mit einem bis dahin unbenannten Code, technicalErrorCode (9900, "Technical Error Database") -- ueber die alte Regel schluessig, und der Klaerweg machte daraus declined fuer einen Vorgang, unter dem tatsaechlich Geld geflossen sein kann. Jetzt gilt die Umkehrung: isConclusive ist wahr nur fuer einen Code, dessen Bedeutung GEMESSEN und hier BENANNT ist. Jeder andere -- ob er wie ein Fehlercode aussieht oder nicht, ob er neu ist oder schlicht nie gemessen wurde -- ist eine Wissensluecke, siehe isUnknownCode.

Constructors

TransactionResponse({required Map<String, dynamic> raw, String? transactionId, String? originalTransactionId, String? tid, String? receipt, String? approvalCode, String? reference, String? transactionDate, String? cardNumber, String? cardExpiry, String? brand, String? cardIssuer, String? transactionType, String? currency, num? amount, num? tip, String? responseCode, String? responseText, Cvm? cvm, String? bin, String? statusCode, String? statusText, String? state, bool? cleared, String? source, String? approvalDate, String? actionCode, String? aid, String? vu})
const
TransactionResponse.fromJson(Map<String, dynamic> json)
factory

Properties

actionCode String?
Action code. Status v2 only.
final
aid String?
EMV Application Identifier. Status v2 only.
final
amount num?
Transaction amount.
final
approvalCode String?
Authorization / approval code.
final
approvalDate String?
Approval date. Status v2 only.
final
bin String?
BIN — the first 6 digits of the PAN.
final
brand String?
Card brand, e.g. Visa, MasterCard, Maestro.
final
cardExpiry String?
Card expiry, format YYMM.
final
cardIssuer String?
Card issuer.
final
cardNumber String?
Masked card number (PAN).
final
cleared bool?
Whether the transaction has already been cleared. Status v2 only.
final
currency String?
Currency (ISO 4217 alpha), e.g. EUR.
final
cvm Cvm?
Cardholder verification method.
final
hashCode int
The hash code for this object.
no setterinherited
isApproved bool
true when the transaction was approved (responseCode == "0").
no setter
isCanceled bool
true, wenn der Vorgang aufgehoben wurde (transactionCanceledCode).
no setter
isConclusive bool
true, wenn diese Antwort ueberhaupt eine Aussage ueber den Ausgang traegt -- also einen Ergebniscode nennt, dessen Bedeutung GEMESSEN und in _knownOutcomeCodes benannt ist.
no setter
isInProgress bool
true when a status query reports the transaction is still running (responseCode == null).
no setter
isInvalid bool
true, wenn das Terminal den Vorgang als ungueltig abgewiesen hat (invalidTransactionCode) -- eine positive Aussage: nichts geschehen.
no setter
isNoStatement bool
true, wenn das Terminal zu dieser Kennung keine Auskunft gibt (noStatementCode).
no setter
isNotAbortable bool
true, wenn ein HpsClient.abort daran scheiterte, dass der Vorgang nicht mehr abbrechbar war (notAbortableCode).
no setter
isTechnicalError bool
true, wenn das Terminal einen technischen Fehler meldet (technicalErrorCode) -- gemessen im Zusammenhang mit einer nicht rein numerischen Kennung, aber keine Aussage ueber den Vorgang selbst.
no setter
isUnknownCode bool
true, wenn ein Ergebniscode VORHANDEN ist, aber weder ein GEMESSENES Ergebnis benennt (isConclusive) noch eine der beiden gemessenen Wissensluecken ist (isNoStatement, isTechnicalError).
no setter
originalTransactionId String?
Identifier of the original transaction (for capture / refund / void).
final
raw Map<String, dynamic>
The raw decoded JSON, for fields not modelled explicitly.
final
receipt String?
Receipt number.
final
reference String?
Reference echoed from the request (null if none was sent).
final
responseCode String?
Response code. "0" means approved. null (status v2 only) means the transaction is still in progress — see isInProgress. An empty string from the terminal is normalised to null by fromJson: an empty code carries no more information than a missing one, and treating it as a real (non-"0") code would misreport an unresolved outcome as declined.
final
responseText String?
Human readable response text.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source String?
What triggered the transaction, e.g. API, ECR. Status v2 only.
final
state String?
Transaction state, e.g. OK, VOID, FAILED. Status v2 only.
final
statusCode String?
Mapped status code (from HOC). Status v2 only.
final
statusText String?
Mapped status text (from HOC). Status v2 only.
final
tid String?
Terminal identifier.
final
tip num?
Tip amount.
final
transactionDate String?
Transaction date/time as returned by the terminal.
final
transactionId String?
Unique transaction identifier (echoed / generated). Store this to later void or query the transaction.
final
transactionType String?
Transaction type, e.g. SELL, PREAUTH, CAPTURE, VOID, REFUND.
final
vu String?
Merchant id (Vertragsunternehmen). Status v2 only.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

abortedCode → const String
Ergebniscode 100002 ("Aborted"): der Zahlungs- oder Gutschriftvorgang wurde abgebrochen, bevor er zu Ende gefuehrt wurde.
amountOutOfRangeCode → const String
Ergebniscode 100019 ("Amount is not in a valid range"): der Betrag liegt ausserhalb des zulaessigen Bereichs.
cardNotPresentCode → const String
Ergebniscode 100003 ("Card not present"): die Karte wurde nicht aufgelegt.
invalidAmountCode → const String
Ergebniscode 9003 ("Invalid Amount"): das Terminal weist den Betrag ab, BEVOR es die Karte anfordert.
invalidTidCode → const String
Ergebniscode 100108 ("Invalid TID"): die uebergebene Terminal-Kennung gibt es an diesem Geraet nicht.
invalidTransactionCode → const String
Ergebniscode 9002 ("Invalid Transaction"): das Terminal hat den Vorgang als UNGUELTIG abgewiesen -- eine positive Aussage, dass nichts geschehen ist.
noStatementCode → const String
Ergebniscode 9027 ("Original Tx not found"): das Terminal hat geantwortet, sagt zu dieser Kennung aber NICHTS aus.
notAbortableCode → const String
Ergebniscode 100010: der Vorgang ist NICHT MEHR ABBRECHBAR.
technicalErrorCode → const String
Ergebniscode 9900 ("Technical Error Database").
transactionCanceledCode → const String
Ergebniscode 9011 ("Transaction Canceled"): der Vorgang unter dieser Kennung wurde aufgehoben.