import type { DiscoverReadersParams, EasyConnectParams, Reader, CreatePaymentIntentParams, GetLocationsParams, Cart, CreateSetupIntentParams, CollectSetupIntentPaymentMethodParams, RefundParams, CollectPaymentMethodParams, ConnectionStatus, PaymentStatus, UserCallbacks, OfflineStatus, ICollectInputsParameters, ConfirmPaymentMethodParams, ProcessPaymentIntentParams, ConfirmSetupIntentMethodParams, ProcessSetupIntentParams, CancelSetupIntentMethodParams, CancelPaymentMethodParams, CollectDataParams, TapToPayUxConfiguration, ConnectReaderParams, PrintContent } from '../types'; import type { StripeError } from '../types/StripeError'; import { cancelProcessSetupIntent } from '../functions'; import type EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter'; /** Event type emitted when the SDK requests a new connection token. */ export declare const FETCH_TOKEN_PROVIDER: string; /** Event type for {@link UserCallbacks.onDidChangeConnectionStatus}. */ export declare const CHANGE_CONNECTION_STATUS: string; /** Event type for {@link UserCallbacks.onDidChangePaymentStatus}. */ export declare const CHANGE_PAYMENT_STATUS: string; /** Event type for {@link UserCallbacks.onFinishDiscoveringReaders}. */ export declare const FINISH_DISCOVERING_READERS: string; /** Event type for {@link UserCallbacks.onDidFinishInstallingUpdate}. */ export declare const FINISH_INSTALLING_UPDATE: string; /** Event type for {@link UserCallbacks.onDidRequestReaderDisplayMessage}. */ export declare const REQUEST_READER_DISPLAY_MESSAGE: string; /** Event type for {@link UserCallbacks.onDidRequestReaderInput}. */ export declare const REQUEST_READER_INPUT: string; /** Event type for {@link UserCallbacks.onDidReportAvailableUpdate}. */ export declare const REPORT_AVAILABLE_UPDATE: string; /** Event type for {@link UserCallbacks.onDidUpdateRequirementsAvailable}. */ export declare const UPDATE_REQUIREMENTS_AVAILABLE: string; /** Event type for {@link UserCallbacks.onDidReportReaderSoftwareUpdateProgress}. */ export declare const REPORT_UPDATE_PROGRESS: string; /** Event type for {@link UserCallbacks.onDidStartInstallingUpdate}. */ export declare const START_INSTALLING_UPDATE: string; /** Event type for {@link UserCallbacks.onUpdateDiscoveredReaders}. */ export declare const UPDATE_DISCOVERED_READERS: string; /** Event type for {@link UserCallbacks.onDidStartReaderReconnect}. */ export declare const START_READER_RECONNECT: string; /** Event type for {@link UserCallbacks.onDidSucceedReaderReconnect}. */ export declare const READER_RECONNECT_SUCCEED: string; /** Event type for {@link UserCallbacks.onDidFailReaderReconnect}. */ export declare const READER_RECONNECT_FAIL: string; /** Event type for {@link UserCallbacks.onDidChangeOfflineStatus}. */ export declare const CHANGE_OFFLINE_STATUS: string; /** Event type for {@link UserCallbacks.onDidForwardPaymentIntent}. */ export declare const FORWARD_PAYMENT_INTENT: string; /** Event type for {@link UserCallbacks.onDidForwardSetupIntent}. */ export declare const FORWARD_SETUP_INTENT: string; /** Event type for {@link UserCallbacks.onDidForwardingFailure}. */ export declare const REPORT_FORWARDING_ERROR: string; /** Event type for {@link UserCallbacks.onDidDisconnect}. */ export declare const DISCONNECT: string; /** Event type for {@link UserCallbacks.onDidUpdateBatteryLevel}. */ export declare const UPDATE_BATTERY_LEVEL: string; /** Event type for {@link UserCallbacks.onDidReportLowBatteryWarning}. */ export declare const REPORT_LOW_BATTERY_WARNING: string; /** Event type for {@link UserCallbacks.onDidReportReaderEvent}. */ export declare const REPORT_READER_EVENT: string; /** * Event type for {@link UserCallbacks.onDidAcceptTermsOfService}. * iOS only: Android does not report this event, so the value is `undefined` there. */ export declare const ACCEPT_TERMS_OF_SERVICE: string | undefined; /** * useStripeTerminal hook Props */ export type Props = UserCallbacks; /** * useStripeTerminal hook. * This hook gives you an acesss to all available SDK methods * as well as the state of the current connection * * @example * ```ts * const { discoverReaders } = useStripeTerminal({ * onUpdateDiscoveredReaders: (readers) => { * setDisoveredReaders(readers) * } * onDidReportReaderSoftwareUpdateProgress: (progress) => { * setCurrentProgress(progress) * } * }) * ``` */ export declare function useStripeTerminal(props?: Props): { /** Initializes the SDK. Call once, before any other method, inside {@link StripeTerminalProvider}. */ initialize: () => Promise; /** Starts discovering readers with the given discovery method. Discovered readers are reported through {@link UserCallbacks.onUpdateDiscoveredReaders}. */ discoverReaders: (params: DiscoverReadersParams) => Promise; /** Cancels an in-progress {@link WithStripeTerminalProps.discoverReaders | discoverReaders} call. */ cancelDiscovering: () => Promise; /** Discovers and connects to a reader in a single call. */ easyConnect: (params: EasyConnectParams) => Promise; /** Cancels an in-progress {@link WithStripeTerminalProps.easyConnect | easyConnect} call. */ cancelEasyConnect: () => Promise; /** Connects to a reader returned by {@link WithStripeTerminalProps.discoverReaders | discoverReaders}. */ connectReader: (params: ConnectReaderParams) => Promise; /** Disconnects from the connected reader. */ disconnectReader: () => Promise; /** Reboots the connected reader. */ rebootReader: () => Promise; /** Creates a PaymentIntent. */ createPaymentIntent: (params: CreatePaymentIntentParams) => Promise; /** Collects a payment method for a PaymentIntent using the connected reader. */ collectPaymentMethod: (params: CollectPaymentMethodParams) => Promise; /** Retrieves a PaymentIntent by its client secret. */ retrievePaymentIntent: (clientSecret: string) => Promise; /** Lists the Locations belonging to the account. */ getLocations: (params: GetLocationsParams) => Promise; /** Confirms a PaymentIntent after {@link WithStripeTerminalProps.collectPaymentMethod | collectPaymentMethod} succeeds. */ confirmPaymentIntent: (param: ConfirmPaymentMethodParams) => Promise; /** Collects a payment method and confirms the PaymentIntent in a single call. */ processPaymentIntent: (param: ProcessPaymentIntentParams) => Promise; /** Creates a SetupIntent. */ createSetupIntent: (params: CreateSetupIntentParams) => Promise; /** Cancels a PaymentIntent. */ cancelPaymentIntent: (params: CancelPaymentMethodParams) => Promise; /** Installs the software update reported by {@link UserCallbacks.onDidReportAvailableUpdate}. */ installAvailableUpdate: () => Promise<{ error?: StripeError; }>; /** Cancels an in-progress reader software update. */ cancelInstallingUpdate: () => Promise<{ error?: StripeError; }>; /** Displays a cart on the reader's screen. */ setReaderDisplay: (cart: Cart) => Promise<{ error?: StripeError; }>; /** Clears the reader's screen. */ clearReaderDisplay: () => Promise; /** Retrieves a SetupIntent by its client secret. */ retrieveSetupIntent: (clientSecret: string) => Promise; /** Collects a payment method for a SetupIntent using the connected reader. */ collectSetupIntentPaymentMethod: (params: CollectSetupIntentPaymentMethodParams) => Promise; /** Cancels a SetupIntent. */ cancelSetupIntent: (params: CancelSetupIntentMethodParams) => Promise; /** Confirms a SetupIntent after {@link WithStripeTerminalProps.collectSetupIntentPaymentMethod | collectSetupIntentPaymentMethod} succeeds. */ confirmSetupIntent: (params: ConfirmSetupIntentMethodParams) => Promise; /** Collects a payment method and confirms the SetupIntent in a single call. */ processSetupIntent: (params: ProcessSetupIntentParams) => Promise; /** Collects a payment method and refunds a charge or PaymentIntent. */ processRefund: (params: RefundParams) => Promise; /** Clears the cached connection token and reader sessions, for example when switching accounts. */ clearCachedCredentials: () => Promise<{ error?: StripeError; }>; /** Cancels an in-progress {@link WithStripeTerminalProps.collectPaymentMethod | collectPaymentMethod} call. */ cancelCollectPaymentMethod: () => Promise<{ error?: StripeError; }>; /** Cancels an in-progress {@link WithStripeTerminalProps.collectSetupIntentPaymentMethod | collectSetupIntentPaymentMethod} call. */ cancelCollectSetupIntent: () => Promise<{ error?: StripeError; }>; /** Cancels an in-progress {@link WithStripeTerminalProps.confirmPaymentIntent | confirmPaymentIntent} call. */ cancelConfirmPaymentIntent: () => Promise<{ error?: StripeError; }>; /** Cancels an in-progress {@link WithStripeTerminalProps.processPaymentIntent | processPaymentIntent} call. */ cancelProcessPaymentIntent: () => Promise<{ error?: StripeError; }>; /** Cancels an in-progress {@link WithStripeTerminalProps.confirmSetupIntent | confirmSetupIntent} call. */ cancelConfirmSetupIntent: () => Promise<{ error?: StripeError; }>; /** Cancels an in-progress {@link WithStripeTerminalProps.processSetupIntent | processSetupIntent} call. */ cancelProcessSetupIntent: typeof cancelProcessSetupIntent; /** Cancels an in-progress {@link WithStripeTerminalProps.processRefund | processRefund} call. */ cancelProcessRefund: () => Promise<{ error?: StripeError; }>; /** Sets the test card number a simulated reader presents. */ setSimulatedCard: (cardNumber: string) => Promise<{ error?: StripeError; }>; /** Simulates the device going offline or back online. */ setSimulatedOfflineMode: (simulatedOffline: boolean) => Promise<{ error?: StripeError; }>; /** Sets the result a simulated reader returns from {@link WithStripeTerminalProps.collectInputs | collectInputs}. */ setSimulatedCollectInputsResult: (simulatedCollectInputsBehavior: string) => Promise<{ error?: StripeError; }>; /** Returns the offline status of the SDK and the connected reader. */ getOfflineStatus: () => Promise; /** Returns the current payment status. */ getPaymentStatus: () => Promise; /** Returns the current reader connection status. */ getConnectionStatus: () => Promise; /** Returns the connected reader, if any. */ getConnectedReader: () => Promise; /** Returns the connected reader's settings. */ getReaderSettings: () => Promise; /** Updates the connected reader's settings. */ setReaderSettings: (params: Reader.ReaderSettingsParameters) => Promise; /** Displays forms on the reader and collects the customer's input. */ collectInputs: (params: ICollectInputsParameters) => Promise; /** Cancels an in-progress {@link WithStripeTerminalProps.collectInputs | collectInputs} call. */ cancelCollectInputs: () => Promise<{ error?: StripeError; }>; /** Collects non-payment data, such as a magstripe card, using the connected reader. */ collectData: (params: CollectDataParams) => Promise; /** Cancels an in-progress {@link WithStripeTerminalProps.collectData | collectData} call. */ cancelCollectData: () => Promise<{ error?: StripeError; }>; /** * Prints the specified content to the connected reader's printer, if available. * @param content The content to print. Must be an image (JPEG/PNG) encoded as a base64 string or 'data:' URI scheme. */ print: (content: PrintContent) => Promise<{ error?: StripeError; }>; /** Cancels an in-progress automatic reader reconnection. */ cancelReaderReconnection: () => Promise<{ error?: StripeError; }>; /** Checks whether the device supports readers of the given type and discovery method. */ supportsReadersOfType: (params: Reader.ReaderSupportParams) => Promise; /** Customizes the Tap to Pay screen. */ setTapToPayUxConfiguration: (params: TapToPayUxConfiguration) => Promise<{ error?: StripeError; }>; /** Returns the version of the native Stripe Terminal SDK. */ getNativeSdkVersion: () => Promise; /** Event emitter for SDK events. Event types are exported as constants, such as {@link CHANGE_CONNECTION_STATUS}. */ emitter: EventEmitter | undefined; /** Readers found by the latest {@link WithStripeTerminalProps.discoverReaders | discoverReaders} call. */ discoveredReaders: Reader.Type[]; /** The connected reader, or `null` or `undefined` when no reader is connected. */ connectedReader: Reader.Type | null | undefined; /** Whether {@link WithStripeTerminalProps.initialize | initialize} has completed successfully. */ isInitialized: boolean; /** Returns whether the SDK is initialized. Unlike {@link WithStripeTerminalProps.isInitialized | isInitialized}, reads the latest value outside the render cycle. */ getIsInitialized: () => boolean; /** Whether an SDK call is in progress. */ loading: boolean; };