Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class TerminalResult

  1. Object
  2. TerminalResult

The outcome of one operation on a PaymentTerminal: a sale, a pre-authorization, a capture, a reversal, a refund or a lookup.

Only 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 types

enum TerminalResult.StatusHow an operation ended.
class TerminalResult.BuilderAssembles a TerminalResult; what each terminal implementation uses.

Constructors

public TerminalResult(TerminalResult.Status status, String transactionId, String message)

Methods

public TerminalResult.Status getStatus()How the operation ended.
public boolean isApproved()True for Status.APPROVED.
public String getTransactionId()The provider’s identifier for the payment, or null when the provider gave none.
public String getMessage()The provider’s explanation (a decline code, an error message), or null.
public long getApprovedAmount()The amount the terminal reported approved, in the minor unit, tip and cashback included; -1 when it did not report one.
public long getTipAmount()The tip included in getApprovedAmount(), in the minor unit; 0 for none.
public String getCurrency()The ISO 4217 code of the amounts, or null when not reported.
public String getReference()The app’s reference for the operation, as the request carried it or a lookup found it; may be null.
public CardReceipt getReceipt()The data a card receipt must show, or null when the terminal reported none.
public String toString()Returns a string representation of the object.

Inherited methods

Constructor details

TerminalResult

public TerminalResult(TerminalResult.Status status, String transactionId, String message)

Parameters

status TerminalResult.Status
how the operation ended; never null
transactionId String
the provider’s ID for the payment, or null
message String
the provider’s explanation, or null

Method details

getStatus

public TerminalResult.Status getStatus()
How the operation ended.

isApproved

public boolean isApproved()
True for Status.APPROVED.

getTransactionId

public String 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

public String 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 in getApprovedAmount(), in the minor unit; 0 for none.

getCurrency

public String getCurrency()
The ISO 4217 code of the amounts, or null when not reported.

getReference

public String getReference()
The app’s reference for the operation, as the request carried it or a lookup found it; may be null.

getReceipt

public CardReceipt getReceipt()
The data a card receipt must show, or null when the terminal reported none.

toString

public String toString()
Returns 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())