SCPTerminal

Objective-C


@interface SCPTerminal : NSObject

Swift

class Terminal : NSObject

The SCPTerminal singleton 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 shared property, you must set a ConnectionToken provider: an object that implements the SCPConnectionTokenProvider protocol. 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.

Initializing and accessing the SCPTerminal singleton

  • Sets the token provider for the shared (singleton) SCPTerminal instance.

    You must set a token provider before calling shared to initialize the Terminal singleton. We recommend calling setTokenProvider: in your AppDelegate’s application:didFinishLaunchingWithOptions: method. Alternatively, you can wrap your call to setTokenProvider: with a dispatch_once in Objective-C, or use a static constructor in Swift.

    Note that you may only set a token provider before requesting the shared Terminal instance for the first time. In order to switch accounts in your app, e.g. to switch between live and test Stripe API keys on your backend, refer to the documentation for the clearCachedCredentials method on the shared Terminal instance.

    Declaration

    Objective-C

    + (void)setTokenProvider:(nonnull id<SCPConnectionTokenProvider>)tokenProvider;
  • Returns true if a token provider has been set, through setTokenProvider:

    Declaration

    Objective-C

    + (BOOL)hasTokenProvider;

    Swift

    class func hasTokenProvider() -> Bool
  • Sets a block to listen for logs from the shared Terminal instance (optional).

    You can use this optional method to listen for logs from the Stripe Terminal SDK and incorporate them into your own remote logs. Note that these logs are subject to change, and provided for informational and debugging purposes only. You should not depend on them for behavior in your app. Also note that the block you provide may be called from any thread.

    To print internal logs from the SDK to the console, you can set logLevel to SCPLogLevelVerbose on the Terminal instance.

    Declaration

    Objective-C

    + (void)setLogListener:(nonnull SCPLogListenerBlock)listener;

    Swift

    class func setLogListener(_ listener: @escaping LogListenerBlock)
  • Returns the shared (singleton) Terminal instance.

    Before accessing the singleton for the first time, you must first call setTokenProvider:.

    Declaration

    Objective-C

    @property (class, nonatomic, readonly) SCPTerminal *_Nonnull shared;

    Swift

    class var shared: Terminal { get }
  • The Terminal singleton object’s primary delegate. This delegate announces connection and payment status updates to your app.

    Setting this property is mandatory before connecting to a Bluetooth reader, like the BBPOS Chipper 2X BT or the BBPOS WisePad 3. Setting this property is optional before connecting to an internet reader, like the Verifone P400.

    A runtime assert will fire if your app attempts to connect to a reader that requires the delegate.

    Declaration

    Objective-C

    @property (nonatomic, nullable) id<SCPTerminalDelegate> delegate;

Accessing the current state of the singleton

  • Information about the connected SCPReader, or nil if no reader is connected.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) SCPReader *connectedReader;

    Swift

    var connectedReader: SCPReader? { get }
  • The Terminal instance’s current connection status.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SCPConnectionStatus connectionStatus;

    Swift

    var connectionStatus: ConnectionStatus { get }
  • The log level for the SDK. The default value is .none.

    Declaration

    Objective-C

    @property (nonatomic) SCPLogLevel logLevel;

    Swift

    var logLevel: LogLevel { get set }
  • The simulator configuration settings that will be used when connecting to and creating payments with a simulated reader. This object will always exist; to set the configuration settings, set the readwrite properties on Terminal.shared.simulatorConfiguration.

    See

    SCPSimulatorConfiguration

    Declaration

    Objective-C

    @property (nonatomic, readonly) SCPSimulatorConfiguration *_Nonnull simulatorConfiguration;

    Swift

    var simulatorConfiguration: SimulatorConfiguration { get }
  • The Terminal instance’s current payment status.

    Declaration

    Objective-C

    @property (nonatomic, readonly) SCPPaymentStatus paymentStatus;

    Swift

    var paymentStatus: PaymentStatus { get }
  • 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.

    In order to switch accounts in your app:

    • if a reader is connected, call disconnectReader:
    • configure the tokenProvider object to return connection tokens for the new account. The tokenProvider is implemented by your code, and you can do this however you want.
    • call clearCachedCredentials
    • call discoverReaders and connectReader to connect to a reader. The connect call will request a new connection token from your backend server via the token provider.

    An overview of the lifecycle of a connection token under the hood:

    • When the Terminal singleton is initialized, the SDK attempts to proactively request a connection token from your backend server.
    • When connect is called, the SDK uses the connection token and reader information to create a reader session.
    • Subsequent calls to connect will re-use the reader session if the SDK has successfully connected to the reader already. Otherwise, it will require a new connection token when you call connect again.

    Declaration

    Objective-C

    - (void)clearCachedCredentials;

    Swift

    func clearCachedCredentials()

Reader discovery, connection, and updates

  • Begins discovering readers based on the given discovery configuration.

    When discoverReaders is called, the terminal begins scanning for readers using the settings in the given SCPDiscoveryConfiguration. You must implement SCPDiscoveryDelegate to get notified of discovered readers and display discovery results to your user.

    You must call connectBluetoothReader or connectInternetReader while a discovery is taking place. You can only connect to a reader that was returned from the SCPDiscoveryDelegate‘s didUpdateDiscoveredReaders method.

    The discovery process will stop on its own when the terminal successfully connects to a reader, if the command is canceled, or if a discovery error occurs.

    Note

    If discoverReaders is canceled, the completion block will be called with nil (rather than an SCPErrorCanceled error).

    Declaration

    Objective-C

    - (nullable SCPCancelable *)
        discoverReaders:(nonnull SCPDiscoveryConfiguration *)configuration
               delegate:(nonnull id<SCPDiscoveryDelegate>)delegate
             completion:(nonnull SCPErrorCompletionBlock)completion;

    Parameters

    configuration

    The configuration for reader discovery.

    delegate

    Your delegate for reader discovery.

    completion

    The completion block called when the command completes.

  • Attempts to connect to the given Bluetooth reader with a given connection configuration.

    To connect to a Bluetooth reader, your app must register that reader to a Location upon connection. You should create a SCPBluetoothConnectionConfiguration at some point before connecting which specifies the location to which this reader belongs.

    Throughout the lifetime of the connection, the reader will communicate with your app via the SCPBluetoothReaderDelegate to announce transaction status, battery level, and software update information.

    If the connection succeeds, the completion block will be called with the connected reader, and SCPTerminal.connectionStatus will change to .connected.

    If the connection fails, the completion block will be called with an error.

    The SDK must be actively discovering readers in order to connect to one. The discovery process will stop if this connection request succeeds, otherwise the SDK will continue discovering.

    When this method is called, the SDK uses a connection token and the given reader information to register the reader to your Stripe account. If the SDK does not already have a connection token, it will call the fetchConnectionToken method in your SCPConnectionTokenProvider implementation.

    If the reader’s battery is critically low the connect call will fail with SCPErrorBluetoothDisconnected. Plug your reader in to start charging and try again.

    Declaration

    Objective-C

    - (void)connectBluetoothReader:(nonnull SCPReader *)reader
                          delegate:(nonnull id<SCPBluetoothReaderDelegate>)delegate
                  connectionConfig:(nonnull SCPBluetoothConnectionConfiguration *)
                                       connectionConfig
                        completion:(nonnull SCPReaderCompletionBlock)completion;

    Swift

    func connectBluetoothReader(_ reader: SCPReader, delegate: BluetoothReaderDelegate, connectionConfig: SCPBluetoothConnectionConfiguration, completion: @escaping ReaderCompletionBlock)

    Parameters

    reader

    The reader to connect to. This should be a reader recently returned to the didUpdateDiscoveredReaders: method in the discovery delegate.

    delegate

    The delegate used during the lifetime of the connection. See SCPBluetoothReaderDelegate.

    connectionConfig

    The connection configuration for options while connecting to a reader. See SCPBluetoothConnectionConfiguration for more details.

    completion

    The completion block called when the command completes.

  • Attempts to connect to the given Internet reader with a given connection configuration.

    If the connect succeeds, the completion block will be called with the connected reader, and SCPTerminal.connectionStatus will change to .connected.

    If the connect fails, the completion block will be called with an error.

    The SDK must be actively discovering readers in order to connect to one. The discovery process will stop if this connection request succeeds, otherwise the SDK will continue discovering.

    When this method is called, the SDK uses a connection token and the given reader information to create a reader session. If the SDK does not already have a connection token, it will call the `fetchConnectionToken method you defined to fetch one.

    If connectionConfig is set to nil, the SDK will resort to default connection behavior; see the SCPInternetConnectionConfiguration header documentation for more details.

    Declaration

    Objective-C

    - (void)connectInternetReader:(nonnull SCPReader *)reader
                 connectionConfig:
                     (nullable SCPInternetConnectionConfiguration *)connectionConfig
                       completion:(nonnull SCPReaderCompletionBlock)completion;

    Swift

    func connectInternetReader(_ reader: SCPReader, connectionConfig: SCPInternetConnectionConfiguration?, completion: @escaping ReaderCompletionBlock)

    Parameters

    reader

    The reader to connect to. This should be a reader recently returned to the didUpdateDiscoveredReaders: method in the discovery delegate.

    connectionConfig

    The connection configuration for options while connecting to a reader. See SCPInternetConnectionConfiguration for more details.

    completion

    The completion block called when the command completes.

  • Retrieves a list of SCPLocation objects belonging to your merchant. You must specify the ID of one of these locations to register the reader to while connecting to a Bluetooth reader.

    Declaration

    Objective-C

    - (void)listLocations:(nullable SCPListLocationsParameters *)parameters
               completion:(nonnull SCPLocationsCompletionBlock)completion;

    Swift

    func listLocations(parameters: SCPListLocationsParameters?, completion: @escaping LocationsCompletionBlock)

    Parameters

    parameters

    The optional parameters to pass to the List all Locations API endpoint. Pass nil to use the default parameters.

    completion

    The completion block called when the command completes.

  • Installs the available update for the connected reader.

    Stripe Terminal reader updates will either be updated automatically upon connection, or announced as available but not automatically installed. When the Stripe Terminal SDK announces an optional update, you can present that update to your app’s user and let them decide when to perform that update. When your user chooses to perform a reader update, call this method to start the installation.

    In your app you should display the progress of the update to the user. You should also instruct the user to wait for the update to complete: “Do not leave this page, and keep the reader in range and powered on until the update is complete.” You can set UIApplication.shared.isIdleTimerDisabled to true while the update is being installed to prevent the device from automatically locking.

    If an error occurs while installing the update (e.g. because the update was interrupted), the SCPBluetoothReaderDelegate will receive reader:didFinishInstallingUpdate:error: with the error. If the update completed successfully, the same method will be called with nil error.

    You must implement the ability to update your reader’s software in your app. Though we expect required software updates to be very rare, by using Stripe Terminal, you are obligated to include this functionality.

    Note

    It is an error to call this method when the SDK is connected to the Verifone P400 or WisePOS E readers.

    Declaration

    Objective-C

    - (void)installAvailableUpdate;

    Swift

    func installAvailableUpdate()
  • Attempts to disconnect from the currently connected reader.

    If the disconnect succeeds, the completion block is called with nil. If the disconnect fails, the completion block is called with an error.

    Declaration

    Objective-C

    - (void)disconnectReader:(nonnull SCPErrorCompletionBlock)completion;

    Swift

    func disconnectReader(_ completion: @escaping ErrorCompletionBlock)

    Parameters

    completion

    The completion block called when the command completes.

Taking payments

  • Creates a new SCPPaymentIntent with the given parameters.

    Note: If the information required to create a PaymentIntent isn’t readily available in your app, you can create the PaymentIntent on your server and use the retrievePaymentIntent method to retrieve the PaymentIntent in your app.

    - - note: This cannot be used with the Verifone P400 reader. If used with the
    Verifone P400, the completion handler will be called with
    an SCPErrorFeatureNotAvailableWithConnectedReader error.
    

    Declaration

    Objective-C

    - (void)createPaymentIntent:(nonnull SCPPaymentIntentParameters *)parameters
                     completion:(nonnull SCPPaymentIntentCompletionBlock)completion;

    Swift

    func createPaymentIntent(_ parameters: SCPPaymentIntentParameters, completion: @escaping PaymentIntentCompletionBlock)

    Parameters

    parameters

    The parameters for the PaymentIntent to be created.

    completion

    The completion block called when the command completes.

  • Retrieves a SCPPaymentIntent with a client secret.

    If the information required to create a PaymentIntent isn’t readily available in your app, you can create the PaymentIntent on your server and use this method to retrieve the PaymentIntent in your app.

    Declaration

    Objective-C

    - (void)retrievePaymentIntent:(nonnull NSString *)clientSecret
                       completion:
                           (nonnull SCPPaymentIntentCompletionBlock)completion;

    Swift

    func retrievePaymentIntent(clientSecret: String, completion: @escaping PaymentIntentCompletionBlock)

    Parameters

    clientSecret

    The client secret of the PaymentIntent to be retrieved.

    completion

    The completion block called when the command completes.

  • Collects a payment method for the given SCPPaymentIntent.

    Note: collectPaymentMethod does not apply any changes to the PaymentIntent API object. Updates to the PaymentIntent are local to the SDK, and persisted in-memory.

    If collecting a payment method fails, the completion block will be called with an error. After resolving the error, you may call collectPaymentMethod again to either try the same card again, or try a different card.

    If collecting a payment method succeeds, the completion block will be called with a PaymentIntent with status .requiresConfirmation, indicating that you should call processPayment:completion: to finish the payment.

    Note that if collectPaymentMethod is canceled, the completion block will be called with a Canceled error.

    Declaration

    Objective-C

    - (nullable SCPCancelable *)
        collectPaymentMethod:(nonnull SCPPaymentIntent *)paymentIntent
                  completion:(nonnull SCPPaymentIntentCompletionBlock)completion;

    Swift

    func collectPaymentMethod(_ paymentIntent: PaymentIntent, completion: @escaping PaymentIntentCompletionBlock) -> SCPCancelable?

    Parameters

    paymentIntent

    The PaymentIntent to collect a payment method for.

    completion

    The completion block called when the command completes.

  • Processes a payment after collecting a payment method succeeds.

    Synchronous capture

    Stripe Terminal uses two-step card payments to prevent unintended and duplicate payments. When processPayment completes successfully, a charge has been authorized on the customer’s card, but not yet been “captured”. Your app must synchronously notify your backend to capture the PaymentIntent in order to settle the funds to your account.

    Handling failures

    When processPayment fails, the SDK returns an error that includes the updated SCPPaymentIntent. Your app should inspect the updated PaymentIntent to decide how to retry the payment.

    1. If the updated PaymentIntent is nil, the request to Stripe’s servers timed out and the PaymentIntent’s status is unknown. We recommend that you retry processPayment with the original PaymentIntent. If you instead choose to abandon the original PaymentIntent and create a new one, do not capture the original PaymentIntent. If you do, you might charge your customer twice.

    2. If the updated PaymentIntent’s status is still .requiresConfirmation (e.g., the request failed because your app is not connected to the internet), you can call processPayment again with the updated PaymentIntent to retry the request.

    3. If the updated PaymentIntent’s status changes to .requiresPaymentMethod (e.g., the request failed because the card was declined), call collectPaymentMethod with the updated PaymentIntent to try charging another card.

    Declaration

    Objective-C

    - (void)processPayment:(nonnull SCPPaymentIntent *)paymentIntent
                completion:(nonnull SCPProcessPaymentCompletionBlock)completion;

    Swift

    func processPayment(_ paymentIntent: PaymentIntent, completion: @escaping ProcessPaymentCompletionBlock)

    Parameters

    paymentIntent

    The PaymentIntent to confirm.

    completion

    The completion block called when the confirm completes.

  • Cancels an SCPPaymentIntent.

    If the cancel request succeeds, the completion block will be called with the updated PaymentIntent object with status Canceled. If the cancel request fails, the completion block will be called with an error.

    Note

    This cannot be used with the Verifone P400 reader. If used with the Verifone P400, the completion handler will be called with an SCPErrorFeatureNotAvailableWithConnectedReader error.

    Declaration

    Objective-C

    - (void)cancelPaymentIntent:(nonnull SCPPaymentIntent *)paymentIntent
                     completion:(nonnull SCPPaymentIntentCompletionBlock)completion;

    Swift

    func cancelPaymentIntent(_ paymentIntent: PaymentIntent, completion: @escaping PaymentIntentCompletionBlock)

    Parameters

    paymentIntent

    The PaymentIntent to cancel.

    completion

    The completion block called when the cancel completes.

Saving payment details for later use

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

    NOTE: Most integrations should not use readReusableCard.

    You should create a SCPPaymentIntent and use the associated collectPaymentMethod and processPayment methods if you are simply collecting a payment from a customer.

    You can use readReusableCard to read payment details and defer payment for later. The PaymentMethod created by this method will have type card, suitable for use with online payments.

    Note that if you use this method to defer a payment, the transaction will not receive the beneficial rates and liability shift associated with card present transactions.

    If reading a card fails, the completion block will be called with an error containing details about the failure. If reading a card succeeds, the completion block will be called with a PaymentMethod. You should send the ID of the payment method to your backend for further processing. For example, you can use the fingerprint to look up charges created using the same card.

    Note

    This functionality is only available in the US, with either a Chipper 2X BT or Verifone P400 reader.

    Declaration

    Objective-C

    - (nullable SCPCancelable *)
        readReusableCard:(nonnull SCPReadReusableCardParameters *)parameters
              completion:(nonnull SCPPaymentMethodCompletionBlock)completion;

    Swift

    func readReusableCard(_ parameters: SCPReadReusableCardParameters, completion: @escaping PaymentMethodCompletionBlock) -> SCPCancelable?

    Parameters

    parameters

    The parameters for reading the card.

    completion

    The completion block called when the command completes.

  • Creates a new SCPSetupIntent with the given parameters.

    Declaration

    Objective-C

    - (void)createSetupIntent:(nonnull SCPSetupIntentParameters *)setupIntentParams
                   completion:(nonnull SCPSetupIntentCompletionBlock)completion;

    Swift

    func createSetupIntent(_ setupIntentParams: SCPSetupIntentParameters, completion: @escaping SetupIntentCompletionBlock)

    Parameters

    setupIntentParams

    The parameters that control the creation of the SetupIntent

    completion

    The compltion block called when the command completes

  • Retrieves an SCPSetupIntent with a client secret.

    If you’ve created a SetupIntent on your backend, you must retrieve it in the Stripe Terminal SDK before calling collectSetupIntentPaymentMethod.

    Declaration

    Objective-C

    - (void)retrieveSetupIntent:(nonnull NSString *)clientSecret
                     completion:(nonnull SCPSetupIntentCompletionBlock)completion;

    Swift

    func retrieveSetupIntent(clientSecret: String, completion: @escaping SetupIntentCompletionBlock)

    Parameters

    clientSecret

    The client secret of the SetupIntent to be retrieved

    completion

    The completion block called when the command completes.

  • Cancels an SCPPaymentIntent.

    If the cancel request succeeds, the completion block will be called with the updated PaymentIntent object with status Canceled. If the cancel request fails, the completion block will be called with an error.

    Declaration

    Objective-C

    - (void)cancelSetupIntent:(nonnull SCPSetupIntent *)intent
                   completion:(nonnull SCPSetupIntentCompletionBlock)completion;

    Swift

    func cancelSetupIntent(_ intent: SCPSetupIntent, completion: @escaping SetupIntentCompletionBlock)

    Parameters

    intent

    The SetupIntent to cancel.

    completion

    The completion block called when cancellation completes.

  • Collects a payment method for the given SCPSetupIntent.

    This method does not update the SetupIntent API object. All updates are local to the SDK and only persisted in memory. You must confirm the SetupIntent to create a PaymentMethod API object and (optionally) attach that PaymentMethod to a customer.

    If collecting a payment method fails, the completion block will be called with an error. After resolving the error, you may call collectSetupIntentPaymentMethod again to either try the same card again, or try a different card.

    If collecting a payment method succeeds, the completion block will be called with a SetupIntent with status .requiresConfirmation, indicating that you should call confirmSetupIntent:customerConsentCollected:completion: to finish the payment.

    Note that if collectSetupIntentPaymentMethod is canceled, the completion block will be called with a Canceled error.

    Card networks require that you collect consent from the customer before saving and reusing their card information. The SetupIntent confirmation API method normally takes a mandate_data hash that lets you specify details about the customer’s consent. The Stripe Terminal SDK will fill in the mandate_data hash with relevant information, but in order for it to do so, you must specify whether you have gathered consent from the cardholder to collect their payment information in this method’s second parameter.

    The payment method will not be collected without the cardholder’s consent.

    Declaration

    Objective-C

    - (nullable SCPCancelable *)
        collectSetupIntentPaymentMethod:(nonnull SCPSetupIntent *)setupIntent
               customerConsentCollected:(BOOL)customerConsentCollected
                             completion:
                                 (nonnull SCPSetupIntentCompletionBlock)completion;

    Swift

    func collectSetupIntentPaymentMethod(_ setupIntent: SCPSetupIntent, customerConsentCollected: Bool, completion: @escaping SetupIntentCompletionBlock) -> SCPCancelable?

    Parameters

    setupIntent

    The SetupIntent to which payment method information is attached.

    customerConsentCollected

    A boolean that should be set to true if you have successfully collected consent from the cardholder to save their payment information.

    completion

    The completion block called when collection completes.

  • Confirms a SetupIntent after the payment method has been successfully collected.

    Handling failures

    When confirmSetupIntent fails, the SDK returns an error that includes the updated SCPSetupIntent. Your app should inspect the updated SetupIntent to decide how to proceed.

    1. If the updated SetupIntent is nil, the request to Stripe’s servers timed out and the SetupIntent’s status is unknown. We recommend that you retry confirmSetupIntent with the original SetupIntent.

    2. If the updated SetupIntent’s status is still .requiresConfirmation (e.g., the request failed because your app is not connected to the internet), you can call confirmSetupIntent again with the updated SetupIntent to retry the request.

    3. If the updated SetupIntent’s status is .requiresAction, there might be authentication the cardholder must perform offline before the saved PaymentMethod can be used.

    Declaration

    Objective-C

    - (void)confirmSetupIntent:(nonnull SCPSetupIntent *)setupIntent
                    completion:
                        (nonnull SCPConfirmSetupIntentCompletionBlock)completion;

    Swift

    func confirmSetupIntent(_ setupIntent: SCPSetupIntent, completion: @escaping ConfirmSetupIntentCompletionBlock)

    Parameters

    setupIntent

    The SetupIntent to confirm

    completion

    The completion block called when the confirmation completes

Card-present refunds

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

    Some payment methods, like Interac Debit payments, require that in-person payments also be refunded while the cardholder is present. The cardholder must present the Interac card to the card reader; these payments cannot be refunded via the dashboard or the API.

    For payment methods that don’t require the cardholder be present, see https://stripe.com/docs/terminal/payments/refunds

    This method, along with processRefund, allow you to design an in-person refund flow into your app.

    If collecting a payment method fails, the completion block will be called with an error. After resolving the error, you may call collectRefundPaymentMethod again to either try the same card again, or try a different card.

    If collecting a payment method succeeds, the completion block will be called with an nil error. At that point, you can call processRefund to finish refunding the payment method.

    Calling any other SDK methods between collectRefundPaymentMethod and processRefund will result in undefined behavior.

    Note that if collectRefundPaymentMethod is canceled, the completion block will be called with a Canceled error.

    Declaration

    Objective-C

    - (nullable SCPCancelable *)
        collectRefundPaymentMethod:(nonnull SCPRefundParameters *)refundParams
                        completion:(nonnull SCPErrorCompletionBlock)completion;

    Swift

    func collectRefundPaymentMethod(_ refundParams: RefundParameters, completion: @escaping ErrorCompletionBlock) -> SCPCancelable?

    Parameters

    refundParams

    The SCPRefundParameters object that describes how the refund will be created.

    completion

    The completion block called when the command completes.

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

    The completion block will either be called with the successful SCPRefund or with an SCPProcessRefundError.

    When processRefund fails, the SDK returns an error that either includes the failed SCPRefund or the SCPRefundParameters that led to a failure. Your app should inspect the SCPProcessRefundError to decide how to proceed.

    1. If the refund property is nil, the request to Stripe’s servers timed out and the refund’s status is unknown. We recommend that you retry processRefund with the original SCPRefundParameters.

    2. If the SCPProcessRefundError has a failure_reason, the refund was declined. We recommend that you take action based on the decline code you received.

    Note

    collectRefundPaymentMethod:completion and processRefund are only available for payment methods that require in-person refunds. For all other refunds, use the Stripe Dashboard or the Stripe API.

    Declaration

    Objective-C

    - (void)processRefund:(nonnull SCPProcessRefundCompletionBlock)completion;

    Swift

    func processRefund(completion: @escaping ProcessRefundCompletionBlock)

    Parameters

    completion

    The completion block called when the command completes.

Displaying information to customers

  • Clears the reader display and resets it to the splash screen.

    Note

    Only available for the Verifone P400 and BBPOS WisePOS E.

    Declaration

    Objective-C

    - (void)clearReaderDisplay:(nonnull SCPErrorCompletionBlock)completion;

    Swift

    func clearReaderDisplay(_ completion: @escaping ErrorCompletionBlock)

    Parameters

    completion

    The completion block called when the command completes.

  • Updates the reader display with cart 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 SCPCart.

    Note

    Only available for the Verifone P400 and BBPOS WisePOS E.

    Declaration

    Objective-C

    - (void)setReaderDisplay:(nonnull SCPCart *)cart
                  completion:(nonnull SCPErrorCompletionBlock)completion;

    Swift

    func setReaderDisplay(_ cart: Cart, completion: @escaping ErrorCompletionBlock)

    Parameters

    cart

    The cart containing the information that will be displayed.

    completion

    The completion block called when the command completes.

  • Returns an unlocalized string for the given reader input options, e.g. “Swipe / Insert”

    Declaration

    Objective-C

    + (nonnull NSString *)stringFromReaderInputOptions:
        (SCPReaderInputOptions)options;

    Swift

    class func stringFromReaderInputOptions(_ options: ReaderInputOptions = []) -> String
  • Returns an unlocalized string for the given reader display message, e.g. “Retry Card”

    Declaration

    Objective-C

    + (nonnull NSString *)stringFromReaderDisplayMessage:
        (SCPReaderDisplayMessage)message;

    Swift

    class func stringFromReaderDisplayMessage(_ message: ReaderDisplayMessage) -> String
  • Returns an unlocalized string for the given reader event, e.g. “Card Inserted”

    Declaration

    Objective-C

    + (nonnull NSString *)stringFromReaderEvent:(SCPReaderEvent)event;

    Swift

    class func stringFromReaderEvent(_ event: ReaderEvent) -> String
  • Returns an unlocalized string for the given connection status, e.g. “Connecting”

    Declaration

    Objective-C

    + (nonnull NSString *)stringFromConnectionStatus:(SCPConnectionStatus)status;

    Swift

    class func stringFromConnectionStatus(_ status: ConnectionStatus) -> String
  • Returns an unlocalized string for the given payment status, e.g. “Not Ready”

    Declaration

    Objective-C

    + (nonnull NSString *)stringFromPaymentStatus:(SCPPaymentStatus)status;

    Swift

    class func stringFromPaymentStatus(_ status: PaymentStatus) -> String
  • Returns an unlocalized string for the given device type.

    Declaration

    Objective-C

    + (nonnull NSString *)stringFromDeviceType:(SCPDeviceType)deviceType;

    Swift

    class func stringFromDeviceType(_ deviceType: DeviceType) -> String
  • Returns an unlocalized string for the given discovery method.

    Declaration

    Objective-C

    + (nonnull NSString *)stringFromDiscoveryMethod:(SCPDiscoveryMethod)method;

    Swift

    class func stringFromDiscoveryMethod(_ method: DiscoveryMethod) -> String
  • Returns an unlocalized string for the given card brand.

    Declaration

    Objective-C

    + (nonnull NSString *)stringFromCardBrand:(SCPCardBrand)cardBrand;

    Swift

    class func stringFromCardBrand(_ cardBrand: CardBrand) -> String
  • Returns an unlocalized string for the given payment intent status.

    Declaration

    Objective-C

    + (nonnull NSString *)stringFromPaymentIntentStatus:
        (SCPPaymentIntentStatus)paymentIntentStatus;

    Swift

    class func stringFromPaymentIntentStatus(_ paymentIntentStatus: PaymentIntentStatus) -> String
  • Unavailable

    Use initWithConfiguration:tokenProvider:delegate:

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Unavailable

    Use initWithConfiguration:tokenProvider:delegate:

    Declaration

    Objective-C

    + (nonnull instancetype)new;