Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/stripe/stripe-terminal-react-native/llms.txt

Use this file to discover all available pages before exploring further.

useStripeTerminal is the primary hook for interacting with the Stripe Terminal SDK. It returns all SDK methods and current terminal state, and accepts optional event callbacks.
StripeTerminalProvider must be mounted as an ancestor of any component that calls useStripeTerminal.

Usage

import React, { useEffect, useState } from 'react';
import { useStripeTerminal } from '@stripe/stripe-terminal-react-native';

export function ReaderScreen() {
  const [readers, setReaders] = useState([]);

  const {
    initialize,
    discoverReaders,
    connectReader,
    createPaymentIntent,
    collectPaymentMethod,
    confirmPaymentIntent,
    connectedReader,
    loading,
    isInitialized,
  } = useStripeTerminal({
    onUpdateDiscoveredReaders: (discoveredReaders) => {
      setReaders(discoveredReaders);
    },
    onDidChangeConnectionStatus: (status) => {
      console.log('Connection status:', status);
    },
    onDidReportReaderSoftwareUpdateProgress: (progress) => {
      console.log('Update progress:', progress);
    },
  });

  useEffect(() => {
    initialize();
  }, [initialize]);

  const handleDiscover = async () => {
    const { error } = await discoverReaders({
      discoveryMethod: 'bluetoothScan',
      simulated: true,
    });
    if (error) console.error(error);
  };

  const handleConnect = async (reader) => {
    const { reader: connected, error } = await connectReader({
      discoveryMethod: 'bluetoothScan',
      reader,
      locationId: 'tml_xxx',
    });
    if (error) console.error(error);
  };

  // ...
}

Callbacks

Pass event callbacks as an optional object argument to useStripeTerminal. All callbacks are optional.

Discovery

onUpdateDiscoveredReaders
(readers: Reader.Type[]) => void
Called whenever the list of discovered readers is updated during an active discovery session.
onFinishDiscoveringReaders
(error?: StripeError) => void
Called when a discovery session completes or is cancelled. If discovery ended due to an error, error is populated.

Software updates

onDidReportAvailableUpdate
(update: Reader.SoftwareUpdate) => void
Called when the connected reader has a new firmware update available.
onDidStartInstallingUpdate
(update: Reader.SoftwareUpdate) => void
Called when the SDK begins installing a firmware update on the connected reader.
onDidReportReaderSoftwareUpdateProgress
(progress: string) => void
Called repeatedly during update installation with the current progress as a string (e.g. "0.5" for 50%).
onDidFinishInstallingUpdate
(result: UpdateSoftwareResultType) => void
Called when update installation completes. result contains either a update: Reader.SoftwareUpdate on success or an error: StripeError on failure.

Reader input

onDidRequestReaderInput
(input: Reader.InputOptions[]) => void
Called when the reader is waiting for input from the customer. input is an array of accepted input options (e.g. swipe, tap, insert).
onDidRequestReaderDisplayMessage
(message: Reader.DisplayMessage) => void
Called when the reader wants to display a message to the customer (e.g. “Insert card”).

Connection status

onDidChangeConnectionStatus
(status: Reader.ConnectionStatus) => void
Called whenever the reader connection status changes. Possible values: 'notConnected', 'connecting', 'connected', 'discovering', 'reconnecting'.

Payment status

onDidChangePaymentStatus
(status: PaymentStatus) => void
Called whenever the payment status changes. Possible values: 'notReady', 'ready', 'processing', 'waitingForInput'.

Reconnection

onDidStartReaderReconnect
(reader: Reader.Type, reason?: Reader.DisconnectReason) => void
Called when the SDK starts an automatic reconnection attempt after an unexpected disconnection.
onDidSucceedReaderReconnect
(reader: Reader.Type) => void
Called when an automatic reconnection attempt succeeds.
onDidFailReaderReconnect
(reader: Reader.Type) => void
Called when all automatic reconnection attempts have failed.

Offline

onDidChangeOfflineStatus
(status: OfflineStatus) => void
Called when the offline status of the SDK or connected reader changes. status contains separate sdk and reader details about network connectivity and pending offline payment counts.
onDidForwardPaymentIntent
(paymentIntent: PaymentIntent.Type, error: StripeError) => void
Called when an offline-stored payment intent has been forwarded to Stripe. Check error to determine if forwarding succeeded.
onDidForwardingFailure
(error?: StripeError) => void
Called when the SDK fails to forward an offline payment intent.

Disconnection

onDidDisconnect
(reason?: Reader.DisconnectReason) => void
Called when the reader disconnects. reason indicates whether the disconnect was expected or unexpected.

Battery

onDidUpdateBatteryLevel
(result: Reader.BatteryLevel) => void
Called when the connected reader reports a battery level update.
onDidReportLowBatteryWarning
() => void
Called when the connected reader’s battery is low.

Reader events

onDidReportReaderEvent
(event: ReaderEvent) => void
Called when the reader reports a card event. Possible values: 'cardInserted', 'cardRemoved'.

Terms of service

onDidAcceptTermsOfService
() => void
Called when the customer has accepted the Stripe Terminal terms of service on the reader (used with Tap to Pay).

State

The hook returns the following reactive state properties.
connectedReader
Reader.Type | null
The currently connected reader, or null if no reader is connected.
discoveredReaders
Reader.Type[]
The list of readers found during the current or most recent discovery session.
loading
boolean
true while an SDK operation is in progress.
isInitialized
boolean
true after initialize() has completed successfully.

Methods

Initialization

initialize()

Initializes the Stripe Terminal SDK. Must be called before any other SDK method. Call this from a component nested inside StripeTerminalProvider.
async function initialize(): Promise<InitializeResultType>
// InitializeResultType: { reader?: Reader.Type; error?: undefined } | { error: StripeError; reader?: undefined }

Discovery and connection

discoverReaders(params)

Begins scanning for readers using the specified discovery method. Updates are delivered via the onUpdateDiscoveredReaders callback.
async function discoverReaders(
  params: DiscoverReadersParams
): Promise<{ error?: StripeError }>

// DiscoverReadersParams is one of:
type DiscoverBluetoothScanParams = {
  discoveryMethod: 'bluetoothScan';
  timeout?: number;
  simulated?: boolean;
};

type DiscoverBluetoothProximityParams = {
  discoveryMethod: 'bluetoothProximity';
  simulated?: boolean;
};

type DiscoverInternetParams = {
  discoveryMethod: 'internet';
  timeout?: number;
  simulated?: boolean;
  locationId?: string;
  discoveryFilter?: DiscoveryFilter;
};

type DiscoverUsbParams = {
  discoveryMethod: 'usb';
  timeout?: number;
  simulated?: boolean;
};

type DiscoverAppsOnDevicesParams = {
  discoveryMethod: 'appsOnDevices';
};

type DiscoverTapToPayParams = {
  discoveryMethod: 'tapToPay';
  simulated?: boolean;
};

cancelDiscovering()

Cancels an in-progress discovery session.
async function cancelDiscovering(): Promise<{ error?: StripeError }>

easyConnect(params)

Combines discovery and connection into a single call. Discovers readers and automatically connects to the first compatible one found.
async function easyConnect(
  params: EasyConnectParams
): Promise<ConnectReaderResultType>

// EasyConnectParams is one of:
type EasyConnectInternetParams = {
  discoveryMethod: 'internet';
  timeout?: number;
  simulated?: boolean;
  locationId?: string;
  discoveryFilter?: DiscoveryFilter;
  failIfInUse?: boolean;
};

type EasyConnectTapToPayParams = {
  discoveryMethod: 'tapToPay';
  simulated?: boolean;
  locationId: string;
  autoReconnectOnUnexpectedDisconnect?: boolean;
  merchantDisplayName?: string;
  onBehalfOf?: string;
  tosAcceptancePermitted?: boolean;
};

type EasyConnectAppsOnDevicesParams = {
  discoveryMethod: 'appsOnDevices';
};

cancelEasyConnect()

Cancels an in-progress easyConnect operation.
async function cancelEasyConnect(): Promise<{ error?: StripeError }>

connectReader(params)

Connects to a specific reader from the discovered readers list.
async function connectReader(
  params: ConnectReaderParams
): Promise<ConnectReaderResultType>
// ConnectReaderResultType: { reader: Reader.Type } | { error: StripeError }

// ConnectReaderParams is one of:
type ConnectBluetoothReaderParams = {
  discoveryMethod: 'bluetoothScan';
  reader: Reader.Type;
  locationId: string;
  autoReconnectOnUnexpectedDisconnect?: boolean;
  onPaymentMethodSelectionRequired?: PaymentMethodSelectionHandler;
  onQrCodeDisplayRequired?: QrCodeDisplayHandler;
};

type ConnectBluetoothProximityReaderParams = {
  discoveryMethod: 'bluetoothProximity';
  reader: Reader.Type;
  locationId: string;
  autoReconnectOnUnexpectedDisconnect?: boolean;
  onPaymentMethodSelectionRequired?: PaymentMethodSelectionHandler;
  onQrCodeDisplayRequired?: QrCodeDisplayHandler;
};

type ConnectUsbReaderParams = {
  discoveryMethod: 'usb';
  reader: Reader.Type;
  locationId: string;
  autoReconnectOnUnexpectedDisconnect?: boolean;
  onPaymentMethodSelectionRequired?: PaymentMethodSelectionHandler;
  onQrCodeDisplayRequired?: QrCodeDisplayHandler;
};

type ConnectTapToPayParams = {
  discoveryMethod: 'tapToPay';
  reader: Reader.Type;
  locationId: string;
  onBehalfOf?: string;
  merchantDisplayName?: string;
  tosAcceptancePermitted?: boolean;
  autoReconnectOnUnexpectedDisconnect?: boolean;
};

type ConnectAppsOnDevicesParams = {
  discoveryMethod: 'appsOnDevices';
  reader: Reader.Type;
};

type ConnectInternetReaderParams = {
  discoveryMethod: 'internet';
  reader: Reader.Type;
  failIfInUse?: boolean;
};

disconnectReader()

Disconnects from the currently connected reader.
async function disconnectReader(): Promise<{ error?: StripeError }>

rebootReader()

Reboots the currently connected reader.
async function rebootReader(): Promise<{ error?: StripeError }>

supportsReadersOfType(params)

Checks whether the device supports connecting to readers of the specified type.
async function supportsReadersOfType(
  params: Reader.ReaderSupportParams
): Promise<Reader.ReaderSupportResult>

type ReaderSupportResult = {
  readerSupportResult: boolean;
  error?: StripeError;
};

getConnectionStatus()

Returns the current reader connection status.
async function getConnectionStatus(): Promise<ConnectionStatus>
// ConnectionStatus: 'notConnected' | 'connecting' | 'connected' | 'discovering' | 'reconnecting'

getConnectedReader()

Returns the currently connected reader, or null if no reader is connected.
async function getConnectedReader(): Promise<Reader.Type | null>

cancelReaderReconnection()

Cancels an in-progress automatic reader reconnection.
async function cancelReaderReconnection(): Promise<{ error?: StripeError }>

getLocations(params)

Retrieves a paginated list of Stripe Terminal locations registered to your account. Useful for letting users select a location when connecting a reader.
async function getLocations(
  params: GetLocationsParams
): Promise<GetLocationsResultType>

type GetLocationsParams = {
  limit?: number;
  endingBefore?: string;
  startingAfter?: string;
};

type GetLocationsResultType =
  | { locations: Location[]; hasMore: boolean; error?: undefined }
  | { locations?: undefined; hasMore?: undefined; error: StripeError };

type Location = {
  id: string;
  displayName?: string;
  livemode: boolean;
  address?: Address;
};

Payments

createPaymentIntent(params)

Creates a new PaymentIntent with the given parameters.
async function createPaymentIntent(
  params: CreatePaymentIntentParams
): Promise<PaymentIntentResultType>

type CreatePaymentIntentParams = {
  amount: number;
  currency: string;
  setupFutureUsage?: 'off_session' | 'on_session';
  onBehalfOf?: string;
  transferDataDestination?: string;
  applicationFeeAmount?: number;
  description?: string;
  statementDescriptor?: string;
  statementDescriptorSuffix?: string;
  receiptEmail?: string;
  customer?: string;
  transferGroup?: string;
  metadata?: Record<string, string>;
  paymentMethodOptions?: PaymentMethodOptions;
  captureMethod?: 'automatic' | 'manual';
  offlineBehavior?: 'prefer_online' | 'require_online' | 'force_offline';
  // iOS only:
  paymentMethodTypes?: string[];
};

retrievePaymentIntent(clientSecret)

Retrieves an existing PaymentIntent by its client secret.
async function retrievePaymentIntent(
  clientSecret: string
): Promise<PaymentIntentResultType>

collectPaymentMethod(params)

Collects a payment method for the given PaymentIntent.
async function collectPaymentMethod(
  params: CollectPaymentMethodParams
): Promise<PaymentIntentResultType>

type CollectPaymentMethodParams = {
  paymentIntent: PaymentIntent.Type;
  skipTipping?: boolean;
  tipEligibleAmount?: number;
  updatePaymentIntent?: boolean;
  customerCancellation?: CustomerCancellation;
  requestDynamicCurrencyConversion?: boolean;
  surchargeNotice?: string;
  allowRedisplay?: AllowRedisplay;
  motoConfiguration?: MotoConfiguration;
};

confirmPaymentIntent(params)

Confirms the PaymentIntent after a payment method has been collected.
async function confirmPaymentIntent(
  params: ConfirmPaymentMethodParams
): Promise<PaymentIntentResultType>

type ConfirmPaymentMethodParams = {
  paymentIntent: PaymentIntent.Type;
  surcharge?: Surcharge;
  returnUrl?: string;
};

processPaymentIntent(params)

Combines collectPaymentMethod and confirmPaymentIntent into a single call.
async function processPaymentIntent(
  params: ProcessPaymentIntentParams
): Promise<PaymentIntentResultType>

type ProcessPaymentIntentParams = {
  paymentIntent: PaymentIntent.Type;
  skipTipping?: boolean;
  tipEligibleAmount?: number;
  updatePaymentIntent?: boolean;
  customerCancellation?: CustomerCancellation;
  requestDynamicCurrencyConversion?: boolean;
  surchargeNotice?: string;
  allowRedisplay?: AllowRedisplay;
  motoConfiguration?: MotoConfiguration;
  surcharge?: Surcharge;
  returnUrl?: string;
};

cancelPaymentIntent(params)

Cancels the given PaymentIntent.
async function cancelPaymentIntent(
  params: CancelPaymentMethodParams
): Promise<PaymentIntentResultType>

type CancelPaymentMethodParams = {
  paymentIntent: PaymentIntent.Type;
};

cancelCollectPaymentMethod()

Cancels an in-progress collectPaymentMethod operation.
async function cancelCollectPaymentMethod(): Promise<{ error?: StripeError }>

cancelConfirmPaymentIntent()

Cancels an in-progress confirmPaymentIntent operation.
async function cancelConfirmPaymentIntent(): Promise<{ error?: StripeError }>

cancelProcessPaymentIntent()

Cancels an in-progress processPaymentIntent operation.
async function cancelProcessPaymentIntent(): Promise<{ error?: StripeError }>

getPaymentStatus()

Returns the current payment status.
async function getPaymentStatus(): Promise<PaymentStatus>
// PaymentStatus: 'notReady' | 'ready' | 'processing' | 'waitingForInput'

Setup intents

createSetupIntent(params)

Creates a new SetupIntent.
async function createSetupIntent(
  params: CreateSetupIntentParams
): Promise<SetupIntentResultType>

type CreateSetupIntentParams = {
  customer?: string;
  description?: string;
  metadata?: Record<string, string>;
  onBehalfOf?: string;
  paymentMethodTypes?: string[];
  usage?: string;
};

retrieveSetupIntent(clientSecret)

Retrieves an existing SetupIntent by its client secret.
async function retrieveSetupIntent(
  clientSecret: string
): Promise<SetupIntentResultType>

collectSetupIntentPaymentMethod(params)

Collects a payment method for the given SetupIntent.
async function collectSetupIntentPaymentMethod(
  params: CollectSetupIntentPaymentMethodParams
): Promise<SetupIntentResultType>

type CollectSetupIntentPaymentMethodParams = {
  setupIntent: SetupIntent.Type;
  allowRedisplay?: AllowRedisplay;
  customerCancellation?: CustomerCancellation;
  motoConfiguration?: MotoConfiguration;
  collectionReason?: CollectionReason;
};

confirmSetupIntent(params)

Confirms the SetupIntent.
async function confirmSetupIntent(
  params: ConfirmSetupIntentMethodParams
): Promise<SetupIntentResultType>

type ConfirmSetupIntentMethodParams = {
  setupIntent: SetupIntent.Type;
};

processSetupIntent(params)

Combines collectSetupIntentPaymentMethod and confirmSetupIntent into a single call.
async function processSetupIntent(
  params: ProcessSetupIntentParams
): Promise<SetupIntentResultType>

type ProcessSetupIntentParams = {
  setupIntent: SetupIntent.Type;
  allowRedisplay?: AllowRedisplay;
  customerCancellation?: CustomerCancellation;
  motoConfiguration?: MotoConfiguration;
  collectionReason?: CollectionReason;
};

cancelSetupIntent(params)

Cancels the given SetupIntent.
async function cancelSetupIntent(
  params: CancelSetupIntentMethodParams
): Promise<SetupIntentResultType>

type CancelSetupIntentMethodParams = {
  setupIntent: SetupIntent.Type;
};

cancelCollectSetupIntent()

Cancels an in-progress collectSetupIntentPaymentMethod operation.
async function cancelCollectSetupIntent(): Promise<{ error?: StripeError }>

cancelConfirmSetupIntent()

Cancels an in-progress confirmSetupIntent operation.
async function cancelConfirmSetupIntent(): Promise<{ error?: StripeError }>

cancelProcessSetupIntent()

Cancels an in-progress processSetupIntent operation.
async function cancelProcessSetupIntent(): Promise<{ error?: StripeError }>

Refunds

processRefund(params)

Processes an in-person refund. Accepts either a paymentIntentId + clientSecret or a chargeId.
async function processRefund(
  params: RefundParams
): Promise<ProcessRefundResultType>
// ProcessRefundResultType: { refund?: Refund.Props; error?: StripeError }

type RefundParamsWithPaymentIntentId = {
  paymentIntentId: string;
  clientSecret: string;
  amount: number;
  currency: string;
  refundApplicationFee?: boolean;
  reverseTransfer?: boolean;
  customerCancellation?: CustomerCancellation;
  metadata?: Record<string, string>;
};

type RefundParamsWithChargeId = {
  chargeId: string;
  amount: number;
  currency: string;
  refundApplicationFee?: boolean;
  reverseTransfer?: boolean;
  customerCancellation?: CustomerCancellation;
  metadata?: Record<string, string>;
};

cancelProcessRefund()

Cancels an in-progress processRefund operation.
async function cancelProcessRefund(): Promise<{ error?: StripeError }>

Reader display

setReaderDisplay(cart)

Displays cart or line-item information on the reader’s screen.
async function setReaderDisplay(
  cart: Cart
): Promise<{ error?: StripeError }>

type Cart = {
  currency: string;
  tax: number;
  total: number;
  lineItems: LineItem[];
};

type LineItem = {
  displayName: string;
  quantity: number;
  amount: number;
};

clearReaderDisplay()

Clears any content currently displayed on the reader’s screen.
async function clearReaderDisplay(): Promise<{ error?: StripeError }>

Reader settings

getReaderSettings()

Retrieves the current settings of the connected reader.
async function getReaderSettings(): Promise<{ readerSettings?: Reader.ReaderSettings; error?: StripeError }>

setReaderSettings(params)

Updates the settings of the connected reader.
async function setReaderSettings(
  params: Reader.ReaderSettingsParameters
): Promise<{ readerSettings?: Reader.ReaderSettings; error?: StripeError }>

setTapToPayUxConfiguration(params)

Configures the Tap to Pay UX (tap zone position, dark mode, colors).
async function setTapToPayUxConfiguration(
  params: TapToPayUxConfiguration
): Promise<{ error?: StripeError }>

type TapToPayUxConfiguration = {
  tapZone?: TapZone;
  darkMode?: DarkMode; // 'dark' | 'light' | 'system'
  colors?: {
    primary?: string;
    success?: string;
    error?: string;
  };
};

Inputs and data

collectInputs(params)

Collects one or more structured inputs from the customer on the reader screen (text, phone, email, signature, numeric, or selection).
async function collectInputs(
  params: ICollectInputsParameters
): Promise<ICollectInputsResults>

interface ICollectInputsParameters {
  inputs: Array<IInput>;
}

interface IInput {
  formType: FormType; // 'selection' | 'signature' | 'phone' | 'email' | 'numeric' | 'text'
  required?: boolean | null;
  title: string;
  description?: string | null;
  toggles?: IToggle[] | null;
  skipButtonText?: string | null;
  submitButtonText?: string | null;
  selectionButtons?: ISelectionButton[];
}

cancelCollectInputs()

Cancels an in-progress collectInputs operation.
async function cancelCollectInputs(): Promise<{ error?: StripeError }>

collectData(params)

Collects non-payment card data from the reader (e.g. NFC UID or magstripe).
async function collectData(
  params: CollectDataParams
): Promise<CollectDataResultType>

interface CollectDataParams {
  collectDataType: CollectDataType; // 'magstripe' | 'nfcUid' | 'unknown'
  customerCancellation: CustomerCancellation;
}

cancelCollectData()

Cancels an in-progress collectData operation.
async function cancelCollectData(): Promise<{ error?: StripeError }>
Prints content on the connected reader. Accepts a JPEG or PNG image encoded as a base64 string or data: URI.
async function print(content: PrintContent): Promise<{ error?: StripeError }>
// PrintContent: string (base64-encoded image or data: URI)

Offline

getOfflineStatus()

Returns the current offline status for the SDK and connected reader.
async function getOfflineStatus(): Promise<OfflineStatus>

type OfflineStatus = {
  sdk: OfflineStatusDetails;
  reader?: OfflineStatusDetails;
};

type OfflineStatusDetails = {
  networkStatus: 'online' | 'offline' | 'unknown';
  offlinePaymentsCount: number;
  offlinePaymentAmountsByCurrency: { [key: string]: number };
};

Updates

installAvailableUpdate()

Begins installation of a pending firmware update on the connected reader. Progress and completion are reported via the onDidReportReaderSoftwareUpdateProgress and onDidFinishInstallingUpdate callbacks.
async function installAvailableUpdate(): Promise<{ error?: StripeError }>

cancelInstallingUpdate()

Cancels an in-progress firmware update installation.
async function cancelInstallingUpdate(): Promise<{ error?: StripeError }>

Simulation and testing

Simulation methods only work when using the simulated reader environment. Do not call them in production.

simulateReaderUpdate(update)

Simulates a specific reader update scenario for testing.
async function simulateReaderUpdate(
  update: Reader.SimulateUpdateType
): Promise<{ error?: StripeError }>

setSimulatedCard(cardNumber)

Sets the card number that the simulated reader will present during payment collection.
async function setSimulatedCard(
  cardNumber: string
): Promise<{ error?: StripeError }>

setSimulatedOfflineMode(simulatedOffline)

Enables or disables simulated offline mode.
async function setSimulatedOfflineMode(
  simulatedOffline: boolean
): Promise<{ error?: StripeError }>

setSimulatedCollectInputsResult(behavior)

Sets the simulated result behavior for collectInputs.
async function setSimulatedCollectInputsResult(
  behavior: string
): Promise<{ error?: StripeError }>

getNativeSdkVersion()

Returns the version string of the underlying native Stripe Terminal SDK.
async function getNativeSdkVersion(): Promise<string>

Other

clearCachedCredentials()

Clears any cached credentials stored by the SDK. Call this when a user logs out of your application.
async function clearCachedCredentials(): Promise<{ error?: StripeError }>