Terminal

@Singleton
class Terminal

The Terminal is the top-level object for the Stripe Terminal SDK.

Use of this SDK is subject to the Stripe Terminal Terms: https://stripe.com/terminal/legal

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun cancelPaymentIntent(intent: PaymentIntent, callback: PaymentIntentCallback)

Cancels a PaymentIntent.

Link copied to clipboard
fun cancelSetupIntent(setupIntent: SetupIntent, params: SetupIntentCancellationParameters, callback: SetupIntentCallback)

Cancel an existing SetupIntent.

Link copied to clipboard
fun clearCachedCredentials()

Clears the current connection token, saved reader sessions, and any other cached credentials. You can use this method to switch accounts in your app, e.g. to switch between live and test Stripe API keys on your backend.

Link copied to clipboard
fun clearReaderDisplay(callback: Callback)

Clears the reader display and resets it to the splash screen

Link copied to clipboard
fun collectPaymentMethod(intent: PaymentIntent, callback: PaymentIntentCallback): Cancelable
fun collectPaymentMethod(intent: PaymentIntent, callback: PaymentIntentCallback, config: CollectConfiguration?): Cancelable

Collects a payment method for the given PaymentIntent.

Link copied to clipboard
fun collectRefundPaymentMethod(refundParams: RefundParameters, callback: Callback): Cancelable

Initiates an in-person refund with a given set of RefundParameters by collecting the payment method that is to be refunded.

Link copied to clipboard
fun collectSetupIntentPaymentMethod(intent: SetupIntent, customerConsentCollected: Boolean, callback: SetupIntentCallback): Cancelable

Collects a payment method for a SetupIntent.

Link copied to clipboard
fun confirmSetupIntent(intent: SetupIntent, callback: SetupIntentCallback)

Confirm that your customer intends to set up the current or provided payment method.

Link copied to clipboard
fun connectBluetoothReader(reader: Reader, config: ConnectionConfiguration.BluetoothConnectionConfiguration, listener: BluetoothReaderListener?, connectionCallback: ReaderCallback)

Attempts to connect to the given bluetooth reader.

Link copied to clipboard
fun connectHandoffReader(reader: Reader, config: ConnectionConfiguration.HandoffConnectionConfiguration, listener: HandoffReaderListener?, connectionCallback: ReaderCallback)

Attempts to connect to the given reader in handoff mode.

Link copied to clipboard
fun connectInternetReader(reader: Reader, config: ConnectionConfiguration.InternetConnectionConfiguration, connectionCallback: ReaderCallback)

Attempts to connect to the given internet reader.

Link copied to clipboard
fun connectLocalMobileReader(reader: Reader, config: ConnectionConfiguration.LocalMobileConnectionConfiguration, connectionCallback: ReaderCallback)

Attempts to connect to the local device's NFC reader.

Link copied to clipboard
fun connectUsbReader(reader: Reader, config: ConnectionConfiguration.UsbConnectionConfiguration, listener: UsbReaderListener?, connectionCallback: ReaderCallback)

Attempts to connect to the given reader via usb.

Link copied to clipboard
fun createPaymentIntent(params: PaymentIntentParameters, callback: PaymentIntentCallback)
fun createPaymentIntent(params: PaymentIntentParameters, callback: PaymentIntentCallback, createConfiguration: CreateConfiguration?)

Creates a new PaymentIntent with the given parameters.

Link copied to clipboard
fun createSetupIntent(params: SetupIntentParameters, callback: SetupIntentCallback)

Create a new SetupIntent with the given parameters.

Link copied to clipboard
fun disconnectReader(callback: Callback)

Attempts to disconnect from the currently connected reader.

Link copied to clipboard
fun discoverReaders(config: DiscoveryConfiguration, discoveryListener: DiscoveryListener, callback: Callback): Cancelable

Begins discovering readers matching the given DiscoveryConfiguration.

Link copied to clipboard
fun installAvailableUpdate()

Installs a pending update on the reader. The update that will be installed is whatever is currently stored in Reader.availableUpdate. This field can be set either during Terminal.connectBluetoothReader, or whenever a new update is detected. If the field changes, you will be notified via ReaderListener.onReportAvailableUpdate.

Link copied to clipboard
fun listLocations(parameters: ListLocationsParameters, callback: LocationListCallback)

Returns a list of Location objects.

Link copied to clipboard
fun processPayment(intent: PaymentIntent, callback: PaymentIntentCallback)

Processes a payment after collecting a payment method succeeds.

Link copied to clipboard
fun processRefund(callback: RefundCallback)

Processes an in-person refund after the refund payment method has been collected.

Link copied to clipboard
fun readReusableCard(params: ReadReusableCardParameters, callback: PaymentMethodCallback): Cancelable

Reads a card with the given parameters and returns a PaymentMethod.

Link copied to clipboard
fun retrievePaymentIntent(clientSecret: String, callback: PaymentIntentCallback)

Retrieves a PaymentIntent with a client secret.

Link copied to clipboard
fun retrieveSetupIntent(clientSecret: String, callback: SetupIntentCallback)

Retrieves a SetupIntent with a client secret.

Link copied to clipboard
fun setOfflineListener(listener: OfflineListener)

Sets an OfflineListener to the Terminal sdk, through which the application can be notified of the Terminal's transitions between offline and online states. This will replace any previous OfflineListeners that have been registered.

Link copied to clipboard
fun setReaderDisplay(cart: Cart, callback: Callback)

Updates the reader display with transaction information. This method is for display purposes only and has no correlation with what the customer is actually charged. Tax and total are also not automatically calculated and must be set in Cart.

Link copied to clipboard
fun setTerminalListener(listener: TerminalListener)

Sets the current implementation of TerminalListener. This will replace any previous TerminalListeners that have been registered.

Link copied to clipboard
fun supportsReadersOfType(deviceType: DeviceType, discoveryMethod: DiscoveryMethod, simulated: Boolean): ReaderSupportResult

Determine whether the mobile device supports a given reader type using a particular discovery method.

Properties

Link copied to clipboard
val connectedReader: Reader?
Link copied to clipboard
val connectionStatus: ConnectionStatus

Get the current ConnectionStatus

Link copied to clipboard
val networkStatus: NetworkStatus

Get the current NetworkStatus

Link copied to clipboard
val offlinePaymentAmountsByCurrency: Map<String, Long>

Aggregates the sum of processed offline payments for the active account by currency, Returns an empty map when there is no active account for the terminal.

Link copied to clipboard
val offlinePaymentsCount: Int

Returns the total number of processed offline payments for the active account. Would return 0 when there is active account for the terminal.

Link copied to clipboard
val paymentStatus: PaymentStatus

Get the current PaymentStatus

Link copied to clipboard
var simulatorConfiguration: SimulatorConfiguration

The current configuration of the simulated reader. Change this field to see different behavior.