SCPTerminalDelegate

Objective-C

@protocol SCPTerminalDelegate <NSObject>

Swift

protocol TerminalDelegate : NSObjectProtocol

Implement this protocol to handle updates from the Stripe Terminal iOS SDK.

  • The reader disconnected unexpectedly (that is, without your app explicitly calling disconnectReader).

    In your implementation of this method, you should notify your user that the reader disconnected. You may also want to call discoverReaders to begin scanning for readers. Your app can attempt to automatically reconnect to the disconnected reader, or display UI for your user to re-connect to a reader.

    You can trigger this call in your app by powering off the connected reader.

    Declaration

    Objective-C

    - (void)terminal:(nonnull SCPTerminal *)terminal
        didReportUnexpectedReaderDisconnect:(nonnull SCPReader *)reader;

    Swift

    func terminal(_ terminal: Terminal, didReportUnexpectedReaderDisconnect reader: SCPReader)

    Parameters

    terminal

    The originating terminal.

    reader

    The previously connected reader.

  • The SDK reported an event from the reader (e.g. a card was inserted).

    Note

    The Verifone P400 has a built-in display which handles displaying card and payment events to the customer. The SDK will not call this method while connected to the Verifone P400.

    Declaration

    Objective-C

    - (void)terminal:(nonnull SCPTerminal *)terminal
        didReportReaderEvent:(SCPReaderEvent)event
                        info:(nullable NSDictionary *)info;

    Swift

    optional func terminal(_ terminal: Terminal, didReportReaderEvent event: ReaderEvent, info: [AnyHashable : Any]?)

    Parameters

    terminal

    The originating terminal.

    event

    The reader event.

    info

    Additional info associated with the event, or nil.

  • This method is called when the SDK’s currently connected reader has a low battery.

    Note

    The Verifone P400 is powered by an outlet, and does not use battery power. The SDK will not call this method while connected to the Verifone P400.

    Declaration

    Objective-C

    - (void)terminalDidReportLowBatteryWarning:(nonnull SCPTerminal *)terminal;

    Swift

    optional func terminalDidReportLowBatteryWarning(_ terminal: Terminal)

    Parameters

    terminal

    The originating terminal.

  • The currently connected reader’s connectionStatus changed.

    You should not use this method to detect when a reader unexpectedly disconnects from your app, as it cannot be used to accurately distinguish between expected and unexpected disconnect events. To detect unexpect disconnects (e.g. to automatically notify your user), you should instead use the -[SCPTerminalDelegate terminal:didReportUnexpectedReaderDisconnect:] method.

    Declaration

    Objective-C

    - (void)terminal:(nonnull SCPTerminal *)terminal
        didChangeConnectionStatus:(SCPConnectionStatus)status;

    Swift

    optional func terminal(_ terminal: Terminal, didChangeConnectionStatus status: ConnectionStatus)

    Parameters

    terminal

    The originating terminal.

    status

    The SDK’s new connection status.

  • The currently connected reader’s paymentStatus changed.

    Declaration

    Objective-C

    - (void)terminal:(nonnull SCPTerminal *)terminal
        didChangePaymentStatus:(SCPPaymentStatus)status;

    Swift

    optional func terminal(_ terminal: Terminal, didChangePaymentStatus status: PaymentStatus)

    Parameters

    terminal

    The originating terminal.

    status

    The SDK’s new payment status.