export interface StripeTerminalConfig { /** * An event handler that [fetches a connection token](https://stripe.com/docs/terminal/sdk/js#connection-token) from your backend. */ fetchConnectionToken: () => Promise; /** * An event handler called [when a reader disconnects](https://stripe.com/docs/terminal/readers/connecting/verifone-p400#handling-disconnects) from your app. */ onUnexpectedReaderDisconnect: () => void; } /** * The possible methods for discovering a reader. * * @category Reader * @see https://stripe.com/docs/terminal/readers/connecting */ export enum DiscoveryMethod { /** * When discovering a reader using this method, the `discoverReaders` Observable will be called multiple times as the Bluetooth scan proceeds. */ BluetoothScan, /** * If your app will be used in a busy environment with multiple iOS devices pairing to multiple available readers at the same time, we recommend using this discovery method. * * After a reader has been discovered using this method, the LEDs located above the reader's power button will start flashing multiple colors. After discovering the reader, your app should prompt the user to confirm that the reader is flashing, and require a user action (e.g. tapping a button) to connect to the reader. * * When discovering a reader using this method, the `discoverReaders` Observable will be called twice. It will be called for the first time when the reader is initially discovered. The reader's LEDs will begin flashing. After a short delay, `discoverReaders` will be called a second time with an updated reader object, populated with additional info about the device, like its battery level. * * _The Bluetooth Proximity discovery method can only discovery Chipper 2X BT readers._ */ BluetoothProximity, /** * The Internet discovery method searches for internet-connected readers, such as the Verifone P400 or the BBPOS WisePOS E. * * When discovering a reader with this method, the `discoverReaders` Observable will only be called once with a list of readers from `/v1/terminal/readers`. Note that this will include readers that are both online and offline. * * Because the discovery process continues if connecting to a discovered reader fails, the SDK will refresh the list of `Readers` and call your subscriber with the results. * * @see https://stripe.com/docs/api/terminal/readers/list */ Internet, } /** * @category Reader */ export interface DiscoveryConfiguration { /** * The method by which to discover readers. * * @default DiscoveryMethod.BluetoothScan */ discoveryMethod?: DiscoveryMethod; /** * Whether to use simulated discovery to discover a device simulator. * * The Terminal SDK comes with the ability to simulate behavior without using physical hardware. This makes it easy to quickly test your integration end-to-end, from pairing with a reader to taking payments. * * @default true */ simulated?: boolean; } /** * @category Reader */ export interface Reader { /** * The reader's device type. */ deviceType: DeviceType; /** * True if this is a simulated reader. * * `DiscoveryConfiguration` objects with `simulated = true` produce simulated Readers. */ simulated: boolean; /** * The Stripe unique identifier for the reader. */ stripeId?: string; /** * The ID of the reader’s [Location](https://stripe.com/docs/api/terminal/locations/object). * * Internet readers remain registered to the location specified when registering the reader to your account. For internet readers, this field represents that location. If you need to change your internet reader's location, re-register the reader and specify the new location id in the `location` param. See https://stripe.com/docs/api/terminal/readers/create * * Bluetooth readers are designed to be more mobile and must be registered to a location upon each connection. For Bluetooth readers, this field represents the last location that the reader was registered to. If the reader has not been used before, this field will be nil. If you associate the reader to a different location while calling `connectBluetoothReader`, this field will update to that new location's ID. * * @see https://stripe.com/docs/api/terminal/locations */ locationId?: string; /** * Used to tell whether the `location` field has been set. Note that the Verifone P400 and simulated readers will always have an `unknown` `locationStatus`. (Chipper 2X BT and WisePad 3 only.) */ locationStatus: LocationStatus; /** * The reader's serial number. */ serialNumber: string; /** * The reader's current device software version, or `null` if this information is unavailable. */ deviceSoftwareVersion?: string; /** * True if there is an available update. */ isAvailableUpdate?: boolean; /** * The reader's battery level, represented as a boxed float in the range `[0, 1]`. If the reader does not have a battery, or the battery level is unknown, this value is `null`. (Bluetooth readers only.) */ batteryLevel?: number; /** * The reader's battery status. Usable as a general classification for the current battery state. */ batteryStatus: BatteryStatus; /** * The reader's charging state, represented as a `boolean`. If the reader does not have a battery, or the battery level is unknown, this value is `null`. (Bluetooth readers only.) */ isCharging?: boolean; /** * The IP address of the reader. (Internet reader only.) */ ipAddress?: string; /** * The networking status of the reader: either `offline` or `online`. Note that the Chipper 2X and the WisePad 3's statuses will always be `offline`. (Verifone P400 only.) */ status: ReaderNetworkStatus; /** * A custom label that may be given to a reader for easier identification. (Verifone P400 only.) */ label?: string; /** * Has the value true if the object exists in live mode or the value false if the object exists in test mode. */ livemode?: boolean; } /** * @category Terminal */ export enum ConnectionStatus { /** * The SDK is not connected to a reader. */ NotConnected = 0, /** * The SDK is connected to a reader. */ Connected = 1, /** * The SDK is currently connecting to a reader. */ Connecting = 2, } /** * This represents all of the input methods available to your user when the reader begins waiting for input. * * @category Reader * @see https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPReaderInputOptions */ export enum ReaderInputOptions { /** * No input options are available on the reader. */ None = 0, /** * Swipe a magstripe card. */ SwipeCard = 1 << 0, /** * Insert a chip card. */ InsertCard = 1 << 1, /** * Tap a contactless card. */ TapCard = 1 << 2, } /** * The display messages that a reader may request be displayed by your app. * * @category Reader * @see https://stripe.dev/stripe-terminal-ios/docs/Enums/SCPReaderDisplayMessage */ export enum ReaderDisplayMessage { /** * Retry the presented card. */ RetryCard, /** * Insert the presented card. */ InsertCard, /** * Insert or swipe the presented card. */ InsertOrSwipeCard, /** * Swipe the presented card. */ SwipeCard, /** * Remove the presented card. */ RemoveCard, /** * The reader detected multiple contactless cards. Make sure only one contactless card or NFC device is near the reader. */ MultipleContactlessCardsDetected, /** * The card could not be read. Try another read method on the same card, or use a different card. */ TryAnotherReadMethod, /** * The card is invalid. Try another card. */ TryAnotherCard, } /** * The possible device types for a reader. * * @category Reader * @see https://stripe.com/docs/terminal/readers */ export enum DeviceType { /** * The BBPOS Chipper 2X BT mobile reader. * * @see https://stripe.com/docs/terminal/readers/bbpos-chipper2xbt */ Chipper2X, /** * The Verifone P400 countertop reader. * * @see https://stripe.com/docs/terminal/readers/verifone-p400 */ VerifoneP400, /** * The BBPOS WisePad 3 mobile reader. * * Support for this reader is currently in beta. * * @see https://stripe.com/docs/terminal/readers/bbpos-wisepad3 */ WisePad3, /** * The Stripe Reader M2 mobile reader. * * Support for this reader is currently in beta. */ StripeM2, /** * The BBPOS WisePOS E countertop reader. * * Support for this reader is currently in beta. * * @see https://stripe.com/docs/terminal/readers/bbpos-wisepos-e */ WisePosE, Unknown, } /** * A PaymentIntent tracks the process of collecting a payment from your customer. We recommend that you create exactly one PaymentIntent for each order or customer session in your system. You can reference the PaymentIntent later to see the history of payment attempts for a particular session. * * A PaymentIntent transitions through multiple statuses throughout its lifetime and ultimately creates at most one successful charge. * * @category Payment * @see https://stripe.com/docs/api/payment_intents */ export interface PaymentIntent { stripeId: string; created: number; status: PaymentIntentStatus; amount: number; currency: string; } /** * The possible statuses for a PaymentIntent. * * @category Payment * @see https://stripe.com/docs/api/payment_intents/object#payment_intent_object-status */ export enum PaymentIntentStatus { /** * Next step: collect a payment method by calling `collectPaymentMethod`. */ RequiresPaymentMethod, /** * Next step: process the payment by calling `processPayment`. */ RequiresConfirmation, /** * Next step: capture the PaymentIntent on your backend via the Stripe API. */ RequiresCapture, /** * The PaymentIntent is in the middle of full EMV processing. */ Processing, /** * The PaymentIntent was canceled. */ Canceled, /** * The PaymentIntent succeeded. */ Succeeded, } /** * Represents the possible states of the location object for a discovered reader. * * @category Reader Discovery & Connection * @see https://stripe.com/docs/api/terminal/readers/object */ export enum LocationStatus { /** * The location is not known. `location` will be null. * * A reader will only have a location status of `unknown` when a Bluetooth reader's full location information failed to fetch properly during discovery. */ Unknown, /** * The location was successfully set to a known location. `location` is a valid `Location`. */ Set, /** * This location is known to be not set. `location` will be null. */ NotSet, } /** * A categorization of a reader’s battery charge level. * * @category Reader */ export enum BatteryStatus { /** * Battery state is not yet known or not available for the connected reader. */ Unknown, /** * The device’s battery is less than or equal to 5%. */ Critical, /** * The device’s battery is between 5% and 20%. */ Low, /** * The device’s battery is greater than 20%. */ Nominal, } /** * The possible networking statuses of a reader. * * @category Reader * @see https://stripe.com/docs/api/terminal/readers/object */ export enum ReaderNetworkStatus { /** * The reader is offline. Note that Chipper 2x and WisePad 3 will always report `offline`. */ Offline, /** * The reader is online. */ Online, } export interface ReaderSoftwareUpdate { /** * The estimated amount of time for the update. */ estimatedUpdateTime: string; /** * The target version for the update. */ deviceSoftwareVersion: string; }