java.lang.Object | ||
↳ | PayPalRetailObject | |
↳ | com.paypal.paypalretailsdk.TransactionContext |
The TransactionContext class is returned by RetailSDK.getTransactionManager().createTransaction and allows you to control many aspects of the payment or refund flow and observe events that occur during the flows. Simply creating a TransactionContext will not kick off any behaviors, so that you have a chance to configure the transaction context as you wish (enable on-reader tipping , specify transaction options, etc). When you're ready to proceed with the payment flow, call beginPayment()
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface | TransactionContext.CardInsertedHandlerCallback | Called when EMV card inserted was detected. | |||||||||
interface | TransactionContext.CardPresentedCallback | Indicates that the card data was read. | |||||||||
interface | TransactionContext.CompleteCallback | ||||||||||
interface | TransactionContext.ContactlessReaderDeactivatedObserver | Contactless reader was de-activated and the transaction still remains active. | |||||||||
interface | TransactionContext.DidCompleteSignatureObserver | Called when the signature entry is completed | |||||||||
interface | TransactionContext.PinEntryObserver | Called when PIN entry is in progress or complete | |||||||||
interface | TransactionContext.ReaderTippingCompletedObserver | Called when the tipping on reader flow has been completed | |||||||||
interface | TransactionContext.ReceiptOptionHandlerCallback | Called when one of the additional receipt option is selected. | |||||||||
interface | TransactionContext.SignatureCollectorCallback | ||||||||||
interface | TransactionContext.TokenExpirationHandlerCallback | ||||||||||
interface | TransactionContext.TransactionCompletedCallback | Called when either payment completes or fails. | |||||||||
interface | TransactionContext.WillPresentSignatureObserver | Called when the signature input interface will be displayed |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
addContactlessReaderDeactivatedObserver(TransactionContext.ContactlessReaderDeactivatedObserver observer)
Add an observer for the contactlessReaderDeactivated event
| ||||||||||
void |
addDidCompleteSignatureObserver(TransactionContext.DidCompleteSignatureObserver observer)
Add an observer for the didCompleteSignature event
| ||||||||||
void |
addPinEntryObserver(TransactionContext.PinEntryObserver observer)
Add an observer for the pinEntry event
| ||||||||||
void |
addReaderTippingCompletedObserver(TransactionContext.ReaderTippingCompletedObserver observer)
Add an observer for the readerTippingCompleted event
| ||||||||||
void |
addWillPresentSignatureObserver(TransactionContext.WillPresentSignatureObserver observer)
Add an observer for the willPresentSignature event
| ||||||||||
TransactionContext |
beginPayment(TransactionBeginOptions options)
Begin the payment flow (activate payment devices, listen for relevant events from devices)
| ||||||||||
TransactionContext |
beginRefund(Boolean cardPresent, BigDecimal amount)
Begin the flow to issue a refund on the current invoice.
| ||||||||||
void |
clear(TransactionContext.CompleteCallback callback)
Abort an idle transaction abandoning activated readers and all event listeners.
| ||||||||||
void |
clearOnReaderTip()
Clear the on-reader tip that was acquired for this transaction
| ||||||||||
void |
continueWithCard(Card card)
Continue processing a transaction - the behavior of which depends on the presented card.
| ||||||||||
void |
continueWithCash()
Continue processing a cash transaction.
| ||||||||||
void |
continueWithCheck()
Continue processing a check transaction.
| ||||||||||
void |
deactivateFormFactors(List<FormFactor> formFactors, TransactionContext.CompleteCallback callback)
Deactivate form factors without ending the transaction.
| ||||||||||
void |
discardPresentedCard(Card card)
Discard the presented card for non-EMV transactions only
| ||||||||||
void |
dropHandlers()
Remove all handlers
| ||||||||||
Invoice |
getInvoice()
The invoice being processed for this transaction @readonly
| ||||||||||
Boolean |
getIsSignatureRequired()
Given the current state of the invoice and transaction,
is a signature required to secure payment? @readonly
| ||||||||||
PaymentState |
getPaymentState()
Returns the current state of payment
| ||||||||||
TippingState |
getTippingState()
Returns the current state of tipping
| ||||||||||
String |
getTotalDisplayFooter()
While building your invoice, the running total
will be displayed on PaymentDevices capable of displaying messages.
| ||||||||||
TransactionType |
getType()
The type of transaction being attempted
(defaults to Sale if the invoice is not already paid, Refund if it is already paid)
| ||||||||||
Boolean |
isPaymentInRetryOrProgress()
Check to see if payment is in 'retry' state.
| ||||||||||
Boolean |
isRefund()
Is the transaction a type of refund?
| ||||||||||
void |
removeContactlessReaderDeactivatedObserver(TransactionContext.ContactlessReaderDeactivatedObserver observer)
Remove an observer for the contactlessReaderDeactivated event
| ||||||||||
void |
removeDidCompleteSignatureObserver(TransactionContext.DidCompleteSignatureObserver observer)
Remove an observer for the didCompleteSignature event
| ||||||||||
void |
removePinEntryObserver(TransactionContext.PinEntryObserver observer)
Remove an observer for the pinEntry event
| ||||||||||
void |
removeReaderTippingCompletedObserver(TransactionContext.ReaderTippingCompletedObserver observer)
Remove an observer for the readerTippingCompleted event
| ||||||||||
void |
removeWillPresentSignatureObserver(TransactionContext.WillPresentSignatureObserver observer)
Remove an observer for the willPresentSignature event
| ||||||||||
Boolean |
requestPaymentCancellation()
Request to cancel an ongoing payment.
| ||||||||||
void |
setAdditionalReceiptOptions(List<String> additionalReceiptOptions, TransactionContext.ReceiptOptionHandlerCallback receiptHandler)
If you would like to display additional receipt options such as print, etc., you can provide them here.
| ||||||||||
void |
setCardInsertedHandler(TransactionContext.CardInsertedHandlerCallback cardInsertedHandler)
Provide a handler to get notified after chip card insert is detected but before EMV data is read.
| ||||||||||
void |
setCardPresentedHandler(TransactionContext.CardPresentedCallback cardPresentedHandler)
Provide a handler to get notified when card was presented and emv/magstripe data was read.
| ||||||||||
void |
setCompletedHandler(TransactionContext.TransactionCompletedCallback completedHandler)
Provide a handler to get notified once transaction is complete
| ||||||||||
void |
setSignatureCollector(TransactionContext.SignatureCollectorCallback collector)
If you acquire signatures yourself, for example from a Topaz Pen Pad or with an external
camera, set this property to a handler that will be invoked when signature should be
collected.
| ||||||||||
void |
setTokenExpiredHandler(TransactionContext.TokenExpirationHandlerCallback expirationHandler)
Provide a token expiration handler if you want to handle token expirations during a transaction
| ||||||||||
void |
setTotalDisplayFooter(String value)
While building your invoice, the running total
will be displayed on PaymentDevices capable of displaying messages.
| ||||||||||
void |
setType(TransactionType value)
The type of transaction being attempted
(defaults to Sale if the invoice is not already paid, Refund if it is already paid)
| ||||||||||
void |
startInvoiceSync()
Sync the Invoice total to the reader display.
| ||||||||||
void |
syncInvoiceOnce()
Do a one time sync of invoice total to card reader
| ||||||||||
String |
toString()
Returns a string representing the serialized state of the TransactionContext object
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Add an observer for the contactlessReaderDeactivated event
Add an observer for the didCompleteSignature event
Add an observer for the pinEntry event
Add an observer for the readerTippingCompleted event
Add an observer for the willPresentSignature event
Begin the payment flow (activate payment devices, listen for relevant events from devices)
Begin the flow to issue a refund on the current invoice.
Abort an idle transaction abandoning activated readers and all event listeners. The completed event will NOT be fired for this TransactionContext given that you have explicitly abandoned it
Clear the on-reader tip that was acquired for this transaction
Continue processing a transaction - the behavior of which depends on the presented card. If it's a magnetic card or an NFC tap, payment will be attempted and money will move (if successful). If it's an EMV card insertion, we will start the EMV flow which includes a few calls to the server, potentially asking the user to enter a PIN, etc.
Continue processing a cash transaction.
Continue processing a check transaction.
Deactivate form factors without ending the transaction. Once deactivated, you should re-begin the transaction to start taking payments
Discard the presented card for non-EMV transactions only
Remove all handlers
Given the current state of the invoice and transaction, is a signature required to secure payment? @readonly
While building your invoice, the running total will be displayed on PaymentDevices capable of displaying messages. If you set totalDisplayFooter, that will be displayed (centered) after the total amount. Note that once the payment flow starts, EMV certification requires that the display just show the total and iconography corresponding to expected payment types. Your message will not be on that screen.
The type of transaction being attempted (defaults to Sale if the invoice is not already paid, Refund if it is already paid)
Check to see if payment is in 'retry' state. This check helps with disconnection/connection logic when the app goes in the background.
Is the transaction a type of refund?
Remove an observer for the contactlessReaderDeactivated event
Remove an observer for the didCompleteSignature event
Remove an observer for the pinEntry event
Remove an observer for the readerTippingCompleted event
Remove an observer for the willPresentSignature event
Request to cancel an ongoing payment. The request will only be accepted if card was presented and the presented form factor accepts cancellation.
If you would like to display additional receipt options such as print, etc., you can provide them here. These options would be presented on the receipt screen below the Email and Text options.
Provide a handler to get notified after chip card insert is detected but before EMV data is read. cardInsertedHandler.continueWithCardDataRead must be invoked to continue with transaction
Provide a handler to get notified when card was presented and emv/magstripe data was read. TransactionContext.continueWithCard should be invoked to continue the payment
Provide a handler to get notified once transaction is complete
If you acquire signatures yourself, for example from a Topaz Pen Pad or with an external camera, set this property to a handler that will be invoked when signature should be collected. Once you've collected the signature, call the supplied signatureReceiver with a base64 encoded JPG of the signature. Try to keep it under 100k.
Provide a token expiration handler if you want to handle token expirations during a transaction
While building your invoice, the running total will be displayed on PaymentDevices capable of displaying messages. If you set totalDisplayFooter, that will be displayed (centered) after the total amount. Note that once the payment flow starts, EMV certification requires that the display just show the total and iconography corresponding to expected payment types. Your message will not be on that screen.
The type of transaction being attempted (defaults to Sale if the invoice is not already paid, Refund if it is already paid)
Sync the Invoice total to the reader display. Use this function to sync invoice amount on the app to the reader. This automatic invoice syncing will stop based on the transaction state. Use 'syncInvoiceOnce' to do an on-demand push invoice total to the card reader display
Do a one time sync of invoice total to card reader
Returns a string representing the serialized state of the TransactionContext object