public class

TransactionContext

extends PayPalRetailObject
java.lang.Object
   ↳ PayPalRetailObject
     ↳ com.paypal.paypalretailsdk.TransactionContext

Class Overview

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()

Summary

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
From class java.lang.Object

Public Methods

public void addContactlessReaderDeactivatedObserver (TransactionContext.ContactlessReaderDeactivatedObserver observer)

Add an observer for the contactlessReaderDeactivated event

public void addDidCompleteSignatureObserver (TransactionContext.DidCompleteSignatureObserver observer)

Add an observer for the didCompleteSignature event

public void addPinEntryObserver (TransactionContext.PinEntryObserver observer)

Add an observer for the pinEntry event

public void addReaderTippingCompletedObserver (TransactionContext.ReaderTippingCompletedObserver observer)

Add an observer for the readerTippingCompleted event

public void addWillPresentSignatureObserver (TransactionContext.WillPresentSignatureObserver observer)

Add an observer for the willPresentSignature event

public TransactionContext beginPayment (TransactionBeginOptions options)

Begin the payment flow (activate payment devices, listen for relevant events from devices)

public TransactionContext beginRefund (Boolean cardPresent, BigDecimal amount)

Begin the flow to issue a refund on the current invoice.

public void clear (TransactionContext.CompleteCallback callback)

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

public void clearOnReaderTip ()

Clear the on-reader tip that was acquired for this transaction

public void continueWithCard (Card card)

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.

public void continueWithCash ()

Continue processing a cash transaction.

public void continueWithCheck ()

Continue processing a check transaction.

public void deactivateFormFactors (List<FormFactor> formFactors, TransactionContext.CompleteCallback callback)

Deactivate form factors without ending the transaction. Once deactivated, you should re-begin the transaction to start taking payments

public void discardPresentedCard (Card card)

Discard the presented card for non-EMV transactions only

public void dropHandlers ()

Remove all handlers

public Invoice getInvoice ()

The invoice being processed for this transaction @readonly

public Boolean getIsSignatureRequired ()

Given the current state of the invoice and transaction, is a signature required to secure payment? @readonly

public PaymentState getPaymentState ()

Returns the current state of payment

public TippingState getTippingState ()

Returns the current state of tipping

public String getTotalDisplayFooter ()

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.

public TransactionType getType ()

The type of transaction being attempted (defaults to Sale if the invoice is not already paid, Refund if it is already paid)

public Boolean isPaymentInRetryOrProgress ()

Check to see if payment is in 'retry' state. This check helps with disconnection/connection logic when the app goes in the background.

public Boolean isRefund ()

Is the transaction a type of refund?

public void removeContactlessReaderDeactivatedObserver (TransactionContext.ContactlessReaderDeactivatedObserver observer)

Remove an observer for the contactlessReaderDeactivated event

public void removeDidCompleteSignatureObserver (TransactionContext.DidCompleteSignatureObserver observer)

Remove an observer for the didCompleteSignature event

public void removePinEntryObserver (TransactionContext.PinEntryObserver observer)

Remove an observer for the pinEntry event

public void removeReaderTippingCompletedObserver (TransactionContext.ReaderTippingCompletedObserver observer)

Remove an observer for the readerTippingCompleted event

public void removeWillPresentSignatureObserver (TransactionContext.WillPresentSignatureObserver observer)

Remove an observer for the willPresentSignature event

public Boolean requestPaymentCancellation ()

Request to cancel an ongoing payment. The request will only be accepted if card was presented and the presented form factor accepts cancellation.

public 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. These options would be presented on the receipt screen below the Email and Text options.

public void setCardInsertedHandler (TransactionContext.CardInsertedHandlerCallback cardInsertedHandler)

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

public void setCardPresentedHandler (TransactionContext.CardPresentedCallback cardPresentedHandler)

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

public void setCompletedHandler (TransactionContext.TransactionCompletedCallback completedHandler)

Provide a handler to get notified once transaction is complete

public 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. Once you've collected the signature, call the supplied signatureReceiver with a base64 encoded JPG of the signature. Try to keep it under 100k.

public void setTokenExpiredHandler (TransactionContext.TokenExpirationHandlerCallback expirationHandler)

Provide a token expiration handler if you want to handle token expirations during a transaction

public void setTotalDisplayFooter (String value)

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.

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

public void startInvoiceSync ()

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

public void syncInvoiceOnce ()

Do a one time sync of invoice total to card reader

public String toString ()

Returns a string representing the serialized state of the TransactionContext object