Terminal
-
The
SCPTerminalsingleton object exposes an interface for discovering readers, connecting to a reader, creating payments, and saving card information for later use.Before accessing the singleton object using the
sharedproperty, you must initialize the SDK by callinginitWithTokenProvider:with an object that implements theSCPConnectionTokenProviderprotocol. This object should authenticate with your backend, then fetch the secret from a freshly minted ConnectionToken.The SCPTerminal singleton can only be connected to one reader at a time, and can only perform one operation at a time. As a general rule, make sure the completion handler of one operation has been called before calling another operation from within your app.
The Stripe Terminal SDK sends updates to your app by using the delegate pattern. You may want multiple views in your app to respond to these delegate calls. We recommend creating a central delegate announcer which broadcasts all delegate calls to views and ViewControllers that register themselves with that announcer. We have an example implementation of a TerminalDelegateAnnouncer as part of our example application.
See moreDeclaration
Objective-C
@interface SCPTerminal : NSObjectSwift
class Terminal : NSObject -
Before integrating the SDK, you should create an endpoint on your backend server that creates a new connection token via the Stripe Terminal API. The connection token is used by the SDK to connect to a reader.
An overview of the lifecycle of a connection token:
- When Stripe Terminal is initialized, the SDK attempts to proactively request an connection token from your backend server.
- The SDK uses the connection to connect to a reader.
- Subsequent calls to connect require a new connection token. If you disconnect from a reader, and then call connect again, the SDK will need a new connection token from your backend server.
We suggest making your application’s API client conform to this protocol.
See moreDeclaration
Objective-C
@protocol SCPConnectionTokenProviderSwift
protocol ConnectionTokenProvider -
Implement this protocol to handle connection and payment updates from the Stripe Terminal iOS SDK.
See moreDeclaration
Objective-C
@protocol SCPTerminalDelegate <NSObject>Swift
protocol TerminalDelegate : NSObjectProtocol -
Possible reasons for Bluetooth reader disconnects.
See moreDeclaration
Objective-C
enum SCPDisconnectReason : NSUInteger {}Swift
enum DisconnectReason : UInt, @unchecked Sendable -
Implement this protocol to handle callbacks when the SDK is performing actions related to offline mode.
See moreDeclaration
Objective-C
@protocol SCPOfflineDelegate <NSObject>Swift
protocol OfflineDelegate : NSObjectProtocol -
Provides offline status details for the connected reader and the SDK.
See moreDeclaration
Objective-C
@interface SCPOfflineStatus : NSObjectSwift
class OfflineStatus : NSObject -
The various log levels for the SDK.
See moreDeclaration
Objective-C
enum SCPLogLevel : NSUInteger {}Swift
enum LogLevel : UInt, @unchecked Sendable -
An object representing an action that can be canceled.
See moreDeclaration
Objective-C
@interface SCPCancelable : NSObjectSwift
class Cancelable : NSObject -
The current version of this library.
Declaration
Objective-C
static NSString *const _Nonnull SCPSDKVersion = @"5.6.0"Swift
let SCPSDKVersion: String -
The possible network connection statuses for the SDK.
See moreDeclaration
Objective-C
enum SCPNetworkStatus : NSUInteger {}Swift
enum NetworkStatus : UInt, @unchecked Sendable -
Base class for all builders. Defines the
See morebuildmethod that all builders must implement.Declaration
Objective-C
@interface SCPBuilder<__covariant T> : NSObjectSwift
class SCPBuilder<T> : NSObject where T : AnyObject -
Contains configuration information relevant to collecting non-payment data.
See moreDeclaration
Objective-C
@interface SCPCollectDataConfiguration : NSObject <NSCopying>Swift
class CollectDataConfiguration : NSObject, NSCopying -
The
See moreCollectDataConfigurationBuilderis used to create aCollectDataConfigurationobject.Declaration
Objective-C
@interface SCPCollectDataConfigurationBuilder : SCPBuilder <SCPCollectDataConfiguration *>Swift
class CollectDataConfigurationBuilder : SCPBuilder<CollectDataConfiguration> -
The type of data to collect.
See moreDeclaration
Objective-C
enum SCPCollectDataType : NSUInteger {}Swift
enum CollectDataType : UInt, @unchecked Sendable -
Represents non-payment data collected using
See morecollectData.Declaration
Objective-C
@interface SCPCollectedData : NSObjectSwift
class CollectedData : NSObject -
Represents non-payment data collected using
See morecollectDatawith the magstripe interface.Declaration
Objective-C
@interface SCPMagstripeCollectedData : SCPCollectedDataSwift
class MagstripeCollectedData : CollectedData -
Represents non-payment data collected using
See morecollectDatawith the NFC interface.Declaration
Objective-C
@interface SCPNfcUidCollectedData : SCPCollectedDataSwift
class NfcUidCollectedData : CollectedData -
Configures localization of API error messages returned through
SCPApiError.message.API errors surfaced through
NSError‘sSCPErrorKeyStripeAPIErrorwill have theirSCPApiError.messagetranslated to the resolved locale.For smart readers, reader software version 2.43 or later is required for localization.
Note: The scope of localization may expand in future SDK releases. For example,
See moreNSError.localizedDescriptionand other SDK-originated strings may also be localized. Integrations should avoid relying on error message content for application logic. Use error codes such asSCPErrorandSCPApiError.codeinstead.Declaration
Objective-C
@interface SCPLocaleConfig : NSObject <NSCopying>Swift
class LocaleConfig : NSObject, NSCopying
-
Localizes API error messages to a fixed locale tag.
The locale tag must conform to the format
language[-script][-region]where:languageis a 2-3 letter ISO 639 code (e.g., “en”, “fil”)script(optional) is only “Hans” or “Hant”region(optional) is a 2-letter ISO 3166-1 alpha-2 code (e.g., “US”) or a 3-digit UN M.49 code (e.g., “419”)
If the locale is not supported by Stripe’s localization infrastructure, error messages will fall back to English (
See moreen-US).Declaration
Objective-C
@interface SCPHardcodedLocaleConfig : SCPLocaleConfigSwift
class HardcodedLocaleConfig : LocaleConfig -
A builder class for
See moreSCPHardcodedLocaleConfig. The locale tag is validated bybuild:.Declaration
Objective-C
@interface SCPHardcodedLocaleConfigBuilder : SCPBuilder <SCPHardcodedLocaleConfig *>Swift
class HardcodedLocaleConfigBuilder : SCPBuilder<HardcodedLocaleConfig> -
Reports the outcome of localizing an
SCPApiError.message.requestedLocalereflects the locale the SDK sent in theAccept-Languagerequest header.resolvedLocalereflects the locale the message was localized to, taken from theContent-Languageresponse header (defaults toen-USif the header is absent).
The two may differ when the requested locale is not supported — in that case, the server falls back to
See moreen-US.Declaration
Objective-C
@interface SCPLocalizationResult : NSObject <NSCopying>Swift
class LocalizationResult : NSObject, NSCopying
Terminal Reference