Class TerminalPaymentRequest
java.lang.Object
com.codename1.payment.terminal.TerminalPaymentRequest
What a PaymentTerminal should charge.
The amount is in the currency's minor unit -- cents for USD, yen for JPY -- the way every payment provider takes it, so no floating point rounding ever reaches a price.
TerminalPaymentRequest req = new TerminalPaymentRequest(1250, "USD")
.setReference("order-1042");
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongThe amount in the currency's minor unit.longCash handed to the customer, in the minor unit, charged on top ofgetAmount().The ISO 4217 currency code, as given.The provider-side payment this request completes, created by the app's server: a Stripe PaymentIntent's client secret forTapToPay, or its ID (pi_...) forStripeReaderTerminal.The app's own identifier for the sale, such as an order number.longA tip the app already knows, in the minor unit, included ingetAmount()-- the terminal shows and reports it separately.booleanTrue to let the customer add a tip on the terminal before the card is read.booleanTrue to reserve the amount rather than charge it; the money moves only onPaymentTerminal.capture(String, long, String).setAskForTip(boolean askForTip) SetsisAskForTip().setCashbackAmount(long cashbackAmount) SetsgetCashbackAmount().setPreAuthorization(boolean preAuthorization) SetsisPreAuthorization().setProviderReference(String providerReference) SetsgetProviderReference().setReference(String reference) SetsgetReference().setTipAmount(long tipAmount) SetsgetTipAmount().
-
Constructor Details
-
TerminalPaymentRequest
Parameters
-
amount: the amount in the currency's minor unit; must be positive -
currency: the ISO 4217 code, such asUSD
-
-
-
Method Details
-
getAmount
public long getAmount()The amount in the currency's minor unit. -
getCurrency
The ISO 4217 currency code, as given. -
getReference
The app's own identifier for the sale, such as an order number. Sent to providers that record one, and whatPaymentTerminal.lookup(String)finds the payment by; may be null, but a sale without one cannot be looked up after contact is lost. -
setReference
-
getProviderReference
The provider-side payment this request completes, created by the app's server: a Stripe PaymentIntent's client secret forTapToPay, or its ID (pi_...) forStripeReaderTerminal. Most terminals need none. -
setProviderReference
-
isPreAuthorization
public boolean isPreAuthorization()True to reserve the amount rather than charge it; the money moves only onPaymentTerminal.capture(String, long, String). NeedsTerminalOperation.PRE_AUTHORIZATION. -
setPreAuthorization
-
isAskForTip
public boolean isAskForTip()True to let the customer add a tip on the terminal before the card is read. The tip comes back asTerminalResult.getTipAmount(). NeedsTerminalOperation.TIPPING. -
setAskForTip
-
getTipAmount
public long getTipAmount()A tip the app already knows, in the minor unit, included ingetAmount()-- the terminal shows and reports it separately. Zero for none. -
setTipAmount
-
getCashbackAmount
public long getCashbackAmount()Cash handed to the customer, in the minor unit, charged on top ofgetAmount(). Zero for none. NeedsTerminalOperation.CASHBACK, and most acquirers allow it only for debit cards. -
setCashbackAmount
-