Blocks

  • A block called with a connection token or an error from your backend.

    See

    SCPConnectionTokenProvider

    Declaration

    Objective-C

    typedef void (^SCPConnectionTokenCompletionBlock)(NSString *_Nullable,
                                                      NSError *_Nullable)

    Swift

    typealias ConnectionTokenCompletionBlock = (String?, (any Error)?) -> Void

    Parameters

    token

    The connection token from your backend server.

    error

    An error if one occurred, or nil.

  • A block called with an optional error.

    Declaration

    Objective-C

    typedef void (^SCPErrorCompletionBlock)(NSError *_Nullable)

    Swift

    typealias ErrorCompletionBlock = ((any Error)?) -> Void

    Parameters

    error

    The error, or nil if no error occured.

  • A block called with a logline from the SDK.

    Declaration

    Objective-C

    typedef void (^SCPLogListenerBlock)(NSString *_Nonnull)

    Swift

    typealias LogListenerBlock = (String) -> Void

    Parameters

    logline

    An internal logline from the SDK.

  • A block called with a PaymentIntent or an error.

    Declaration

    Objective-C

    typedef void (^SCPPaymentIntentCompletionBlock)(SCPPaymentIntent *_Nullable,
                                                    NSError *_Nullable)

    Swift

    typealias PaymentIntentCompletionBlock = (SCPPaymentIntent?, (any Error)?) -> Void

    Parameters

    intent

    The PaymentIntent, or nil.

    error

    An error if one occurred, or nil.

  • A block called with a PaymentMethod.

    Declaration

    Objective-C

    typedef void (^SCPPaymentMethodCompletionBlock)(SCPPaymentMethod *_Nullable,
                                                    NSError *_Nullable)

    Swift

    typealias PaymentMethodCompletionBlock = (SCPPaymentMethod?, (any Error)?) -> Void

    Parameters

    paymentMethod

    A PaymentMethod object, or nil if an error occurred.

    error

    An error if one occurred, or nil.

  • A block called with a PaymentIntent or a ConfirmPaymentIntentError

    Declaration

    Objective-C

    typedef void (^SCPConfirmPaymentIntentCompletionBlock)(
        SCPPaymentIntent *_Nullable, SCPConfirmPaymentIntentError *_Nullable)

    Swift

    typealias ConfirmPaymentIntentCompletionBlock = (SCPPaymentIntent?, SCPConfirmPaymentIntentError?) -> Void

    Parameters

    intent

    The PaymentIntent, or nil.

    error

    An error if one occurred, or nil.

  • A block called with a reader object or an error.

    Declaration

    Objective-C

    typedef void (^SCPReaderCompletionBlock)(SCPReader *_Nullable,
                                             NSError *_Nullable)

    Swift

    typealias ReaderCompletionBlock = (SCPReader?, (any Error)?) -> Void

    Parameters

    reader

    A reader object, or nil.

    error

    An error if one occurred, or nil.

  • A block called with a Refund or a ConfirmRefundError.

    Declaration

    Objective-C

    typedef void (^SCPConfirmRefundCompletionBlock)(
        SCPRefund *_Nullable, SCPConfirmRefundError *_Nullable)

    Swift

    typealias ConfirmRefundCompletionBlock = (SCPRefund?, SCPConfirmRefundError?) -> Void

    Parameters

    refund

    The Refund, or nil.

    error

    An error if one occurred, or nil.

  • A block called with a SetupIntent or a ConfirmSetupIntentError.

    Declaration

    Objective-C

    typedef void (^SCPConfirmSetupIntentCompletionBlock)(
        SCPSetupIntent *_Nullable, SCPConfirmSetupIntentError *_Nullable)

    Swift

    typealias ConfirmSetupIntentCompletionBlock = (SCPSetupIntent?, SCPConfirmSetupIntentError?) -> Void

    Parameters

    intent

    The SetupIntent, or nil.

    error

    An error if one occurred, or nil.

  • A block called with a list of Locations or an error.

    Declaration

    Objective-C

    typedef void (^SCPLocationsCompletionBlock)(NSArray<SCPLocation *> *_Nullable,
                                                BOOL, NSError *_Nullable)

    Swift

    typealias LocationsCompletionBlock = ([SCPLocation]?, Bool, (any Error)?) -> Void

    Parameters

    locations

    A list of Locations, or nil.

    hasMore

    Indicates whether there are more locations for the account; use the pagination parameters in SCPListLocationsParameters to fetch more locations

    error

    An error if one occurred, or nil.

  • A block called with a Refund or an error.

    Declaration

    Objective-C

    typedef void (^SCPRefundCompletionBlock)(SCPRefund *_Nullable,
                                             NSError *_Nullable)

    Swift

    typealias RefundCompletionBlock = (SCPRefund?, (any Error)?) -> Void

    Parameters

    refund

    The Refund, or nil.

    error

    An error if one occurred, or nil.

  • A block called with a SetupIntent or an error.

    Declaration

    Objective-C

    typedef void (^SCPSetupIntentCompletionBlock)(SCPSetupIntent *_Nullable,
                                                  NSError *_Nullable)

    Swift

    typealias SetupIntentCompletionBlock = (SCPSetupIntent?, (any Error)?) -> Void

    Parameters

    intent

    The SetupIntent, or nil.

    error

    An error if one occurred, or nil.

  • A block called with an array of collect inputs result or an error.

    Declaration

    Objective-C

    typedef void (^SCPCollectInputsCompletionBlock)(
        NSArray<SCPCollectInputsResult *> *_Nullable, NSError *_Nullable)

    Swift

    typealias CollectInputsCompletionBlock = ([SCPCollectInputsResult]?, (any Error)?) -> Void

    Parameters

    collectInputsResults

    The collect inputs results, or nil.

    error

    An error if one occurred, or nil.

  • A block called with a CollectedData object or an error.

    Declaration

    Objective-C

    typedef void (^SCPCollectedDataCompletionBlock)(SCPCollectedData *_Nullable,
                                                    NSError *_Nullable)

    Swift

    typealias CollectedDataCompletionBlock = (SCPCollectedData?, (any Error)?) -> Void

    Parameters

    collectedData

    The collected data object, or nil.

    error

    An error if one occurred, or nil.

  • A block called to provide the selected payment option or an error.

    Call this block with a payment option to indicate successful selection, or with an error to indicate that payment method selection failed or was cancelled.

    Declaration

    Objective-C

    typedef void (^SCPPaymentMethodSelectionCompletionBlock)(
        SCPPaymentOption *_Nullable, NSError *_Nullable)

    Swift

    typealias PaymentMethodSelectionCompletionBlock = (SCPPaymentOption?, (any Error)?) -> Void

    Parameters

    paymentOption

    The selected payment option, or nil if selection failed.

    error

    An error if payment method selection failed, or nil if successful.

  • A block called to indicate success or failure of QR code display.

    Call this block with nil to indicate the QR code was successfully displayed, or with an error to indicate that QR code display failed.

    Declaration

    Objective-C

    typedef void (^SCPQrCodeDisplayCompletionBlock)(NSError *_Nullable)

    Swift

    typealias QrCodeDisplayCompletionBlock = ((any Error)?) -> Void

    Parameters

    error

    An error if QR code display failed, or nil if successful.