SCPTapToPayReaderDelegate

Objective-C

@protocol SCPTapToPayReaderDelegate <SCPReaderDelegate>

Swift

protocol TapToPayReaderDelegate : ReaderDelegate

Implement this protocol to handle a connected tap to pay reader’s events throughout the lifetime of its connection.

Implementing this delegate is required when connecting to any Tap To Pay reader.

The provided delegate must be retained by your application until the reader disconnects.

  • The reader has started installing a software update.

    Declaration

    Objective-C

    - (void)tapToPayReader:(nonnull SCPReader *)reader
        didStartInstallingUpdate:(nonnull SCPReaderSoftwareUpdate *)update
                      cancelable:(nullable SCPCancelable *)cancelable;

    Swift

    func tapToPayReader(_ reader: SCPReader, didStartInstallingUpdate update: SCPReaderSoftwareUpdate, cancelable: SCPCancelable?)

    Parameters

    reader

    The originating reader.

    update

    The SCPReaderSoftwareUpdate with an durationEstimate that can be used to communicate how long the update is expected to take.

    cancelable

    This cancelable is provided to cancel the installation if needed. Canceling a required update will result in a failed connect with error SCPErrorUnsupportedReaderVersion. Some updates will have a nil cancelable because these updates can not be canceled.

  • The reader reported progress on a software update.

    Declaration

    Objective-C

    - (void)tapToPayReader:(nonnull SCPReader *)reader
        didReportReaderSoftwareUpdateProgress:(float)progress;

    Swift

    func tapToPayReader(_ reader: SCPReader, didReportReaderSoftwareUpdateProgress progress: Float)

    Parameters

    reader

    The originating reader.

    progress

    An estimate of the progress of the software update (in the range [0.0, 1.0]).

  • The reader has finished installing an update.

    Declaration

    Objective-C

    - (void)tapToPayReader:(nonnull SCPReader *)reader
        didFinishInstallingUpdate:(nullable SCPReaderSoftwareUpdate *)update
                            error:(nullable NSError *)error;

    Swift

    func tapToPayReader(_ reader: SCPReader, didFinishInstallingUpdate update: SCPReaderSoftwareUpdate?, error: (any Error)?)

    Parameters

    reader

    The originating reader.

    update

    The update that was being installed, if any.

    error

    If the installed failed, this will describe the error preventing install. If it succeeded, the error will be nil.

  • This method is called when the reader begins waiting for input. Use - [SCPTerminal stringFromReaderInputOptions:] to get a user facing string for the input options.

    Declaration

    Objective-C

    - (void)tapToPayReader:(nonnull SCPReader *)reader
        didRequestReaderInput:(SCPReaderInputOptions)inputOptions;

    Swift

    func tapToPayReader(_ reader: SCPReader, didRequestReaderInput inputOptions: ReaderInputOptions = [])

    Parameters

    reader

    The originating reader.

    inputOptions

    The armed input options on the reader.

  • This method is called to request that a prompt be displayed in your app. Use - [SCPTerminal stringFromReaderDisplayMessage:] to get a user facing string for the prompt.

    See

    SCPReaderDisplayMessage

    Declaration

    Objective-C

    - (void)tapToPayReader:(nonnull SCPReader *)reader
        didRequestReaderDisplayMessage:(SCPReaderDisplayMessage)displayMessage;

    Swift

    func tapToPayReader(_ reader: SCPReader, didRequestReaderDisplayMessage displayMessage: ReaderDisplayMessage)

    Parameters

    reader

    The originating reader.

    displayMessage

    The message to display to the user.

  • The reader is reporting that, as part of preparing to accept payments, the terms of service has been accepted.

    Declaration

    Objective-C

    - (void)tapToPayReaderDidAcceptTermsOfService:(nonnull SCPReader *)reader;

    Swift

    optional func tapToPayReaderDidAcceptTermsOfService(_ reader: SCPReader)

    Parameters

    reader

    The originating reader.

  • This method is called when payment method selection is required during payment collection. Payment collection will block until the completion block is invoked with either the selected payment option or a failure.

    Declaration

    Objective-C

    - (void)tapToPayReader:(nonnull SCPReader *)reader
        didRequestPaymentMethodSelection:(nonnull SCPPaymentIntent *)paymentIntent
                 availablePaymentOptions:
                     (nonnull NSArray<SCPPaymentOption *> *)availablePaymentOptions
                              completion:
                                  (nonnull SCPPaymentMethodSelectionCompletionBlock)
                                      completion;

    Swift

    optional func tapToPayReader(_ reader: SCPReader, didRequestPaymentMethodSelection paymentIntent: SCPPaymentIntent, availablePaymentOptions: [SCPPaymentOption]) async throws -> SCPPaymentOption

    Parameters

    reader

    The originating reader.

    paymentIntent

    The PaymentIntent being processed.

    availablePaymentOptions

    Array of available payment options for the customer to choose from.

    completion

    The completion block to invoke with the selected payment option or failure.

  • This method is called when a QR code should be displayed to the user during payment processing. Your app should display the QR code to the customer and call the completion block once the QR code is successfully shown. Payment confirmation will block until the completion block is invoked.

    Declaration

    Objective-C

    - (void)tapToPayReader:(nonnull SCPReader *)reader
        didRequestQrCodeDisplay:(nonnull SCPPaymentIntent *)paymentIntent
                         qrData:(nonnull SCPQrCodeDisplayData *)qrData
                     completion:(nonnull SCPQrCodeDisplayCompletionBlock)completion;

    Swift

    optional func tapToPayReader(_ reader: SCPReader, didRequestQrCodeDisplay paymentIntent: SCPPaymentIntent, qrData: SCPQrCodeDisplayData) async throws

    Parameters

    reader

    The originating reader.

    paymentIntent

    The PaymentIntent being processed.

    qrData

    The QrCodeDisplayData containing the QR code image URLs and expiration information.

    completion

    The completion block to invoke when the QR code is successfully displayed or fails.