Class TerminalResult
The outcome of one operation on a PaymentTerminal: a sale, a
pre-authorization, a capture, a reversal, a refund or a lookup.
Only TerminalResult.Status.APPROVED means money moved (or, for a pre-authorization,
was reserved). The transaction ID is the provider's own -- a Stripe
PaymentIntent ID, an Adyen PSP reference, a ZVT receipt number -- and is
what the app's server should look the payment up by before it fulfills
an order: a result on a device is a report, not proof.
When a terminal cannot tell whether the card was charged, the request
completes with a TerminalOutcomeUnknownException instead of a result,
so a FAILED result always means no money moved.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAssembles aTerminalResult; what each terminal implementation uses.static enumHow an operation ended. -
Constructor Summary
ConstructorsConstructorDescriptionTerminalResult(TerminalResult.Status status, String transactionId, String message) Parameters
-
Method Summary
Modifier and TypeMethodDescriptionlongThe amount the terminal reported approved, in the minor unit, tip and cashback included; -1 when it did not report one.The ISO 4217 code of the amounts, or null when not reported.The provider's explanation (a decline code, an error message), or null.The data a card receipt must show, or null when the terminal reported none.The app's reference for the operation, as the request carried it or a lookup found it; may be null.How the operation ended.longThe tip included ingetApprovedAmount(), in the minor unit; 0 for none.The provider's identifier for the payment, or null when the provider gave none.booleanTrue forTerminalResult.Status.APPROVED.toString()Returns a string representation of the object.
-
Constructor Details
-
TerminalResult
Parameters
-
status: how the operation ended; never null -
transactionId: the provider's ID for the payment, or null -
message: the provider's explanation, or null
-
-
-
Method Details
-
getStatus
How the operation ended. -
isApproved
public boolean isApproved()True forTerminalResult.Status.APPROVED. -
getTransactionId
The provider's identifier for the payment, or null when the provider gave none. Pass it to capture, reverse or refund the payment later. -
getMessage
The provider's explanation (a decline code, an error message), or null. -
getApprovedAmount
public long getApprovedAmount()The amount the terminal reported approved, in the minor unit, tip and cashback included; -1 when it did not report one. Can be less than requested when the issuer approved part of it. -
getTipAmount
public long getTipAmount()The tip included ingetApprovedAmount(), in the minor unit; 0 for none. -
getCurrency
The ISO 4217 code of the amounts, or null when not reported. -
getReference
The app's reference for the operation, as the request carried it or a lookup found it; may be null. -
getReceipt
The data a card receipt must show, or null when the terminal reported none. -
toString
Description copied from class:ObjectReturns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + '@' + Integer.toHexString(hashCode())
-