Type Aliases

The following type aliases are available globally.

  • An empty block, called with no arguments, returning nothing.

    Declaration

    Swift

    public typealias STPVoidBlock = () -> Void
  • A block that may optionally be called with an error.

    Declaration

    Swift

    public typealias STPErrorBlock = (Error?) -> Void

    Parameters

    error

    The error that occurred, if any.

  • A block that contains a boolean success param and may optionally be called with an error.

    Declaration

    Swift

    public typealias STPBooleanSuccessBlock = (Bool, Error?) -> Void

    Parameters

    success

    Whether the task succeeded.

    error

    The error that occurred, if any.

  • A callback to be run with a JSON response.

    Declaration

    Swift

    public typealias STPJSONResponseCompletionBlock = ([AnyHashable : Any]?, Error?) -> Void

    Parameters

    jsonResponse

    The JSON response, or nil if an error occured.

    error

    The error that occurred, if any.

  • A callback to be run with a token response from the Stripe API.

    Declaration

    Swift

    public typealias STPTokenCompletionBlock = (STPToken?, Error?) -> Void

    Parameters

    token

    The Stripe token from the response. Will be nil if an error occurs. - seealso: STPToken

    error

    The error returned from the response, or nil if none occurs. - seealso: StripeError.h for possible values.

  • A callback to be run with a source response from the Stripe API.

    Declaration

    Swift

    public typealias STPSourceCompletionBlock = (STPSource?, Error?) -> Void

    Parameters

    source

    The Stripe source from the response. Will be nil if an error occurs. - seealso: STPSource

    error

    The error returned from the response, or nil if none occurs. - seealso: StripeError.h for possible values.

  • A callback to be run with a source or card response from the Stripe API.

    Declaration

    Swift

    public typealias STPSourceProtocolCompletionBlock = (STPSourceProtocol?, Error?) -> Void

    Parameters

    source

    The Stripe source from the response. Will be nil if an error occurs. - seealso: STPSourceProtocol

    error

    The error returned from the response, or nil if none occurs. - seealso: StripeError.h for possible values.

  • A callback to be run with a PaymentIntent response from the Stripe API.

    Declaration

    Swift

    public typealias STPPaymentIntentCompletionBlock = (STPPaymentIntent?, Error?) -> Void

    Parameters

    paymentIntent

    The Stripe PaymentIntent from the response. Will be nil if an error occurs. - seealso: STPPaymentIntent

    error

    The error returned from the response, or nil if none occurs. - seealso: StripeError.h for possible values.

  • A callback to be run with a PaymentIntent response from the Stripe API.

    Declaration

    Swift

    public typealias STPSetupIntentCompletionBlock = (STPSetupIntent?, Error?) -> Void

    Parameters

    setupIntent

    The Stripe SetupIntent from the response. Will be nil if an error occurs. - seealso: STPSetupIntent

    error

    The error returned from the response, or nil if none occurs. - seealso: StripeError.h for possible values.

  • A callback to be run with a PaymentMethod response from the Stripe API.

    Declaration

    Swift

    public typealias STPPaymentMethodCompletionBlock = (STPPaymentMethod?, Error?) -> Void

    Parameters

    paymentMethod

    The Stripe PaymentMethod from the response. Will be nil if an error occurs. - seealso: STPPaymentMethod

    error

    The error returned from the response, or nil if none occurs. - seealso: StripeError.h for possible values.

  • A callback to be run with an array of PaymentMethods response from the Stripe API.

    Declaration

    Swift

    public typealias STPPaymentMethodsCompletionBlock = ([STPPaymentMethod]?, Error?) -> Void

    Parameters

    paymentMethods

    An array of PaymentMethod from the response. Will be nil if an error occurs. - seealso: STPPaymentMethod

    error

    The error returned from the response, or nil if none occurs. - seealso: StripeError.h for possible values.

  • A callback to be run with a validation result and shipping methods for a shipping address.

    Declaration

    Swift

    public typealias STPShippingMethodsCompletionBlock = (
      STPShippingStatus, Error?, [PKShippingMethod]?, PKShippingMethod?
    ) -> Void

    Parameters

    status

    An enum representing whether the shipping address is valid.

    shippingValidationError

    If the shipping address is invalid, an error describing the issue with the address. If no error is given and the address is invalid, the default error message will be used.

    shippingMethods

    The shipping methods available for the address.

    selectedShippingMethod

    The default selected shipping method for the address.

  • A callback to be run with a file response from the Stripe API.

    Declaration

    Swift

    public typealias STPFileCompletionBlock = (STPFile?, Error?) -> Void

    Parameters

    file

    The Stripe file from the response. Will be nil if an error occurs. - seealso: STPFile

    error

    The error returned from the response, or nil if none occurs. - seealso: StripeError.h for possible values.

  • A callback to be run with a customer response from the Stripe API.

    Declaration

    Swift

    public typealias STPCustomerCompletionBlock = (STPCustomer?, Error?) -> Void

    Parameters

    customer

    The Stripe customer from the response, or nil if an error occurred. - seealso: STPCustomer

    error

    The error returned from the response, or nil if none occurs.

  • A callback to be run with a card PIN response from the Stripe API.

    Declaration

    Swift

    public typealias STPPinCompletionBlock = (STPIssuingCardPin?, STPPinStatus, Error?) -> Void

    Parameters

    cardPin

    The Stripe card PIN from the response. Will be nil if an error occurs. - seealso: STPIssuingCardPin

    status

    The status to help you sort between different error state, or STPPinSuccess when succesful. - seealso: STPPinStatus for possible values.

    error

    The error returned from the response, or nil if none occurs. - seealso: StripeError.h for possible values.

  • A block called with a payment status and an optional error.

    Declaration

    Swift

    public typealias STPPaymentStatusBlock = (STPPaymentStatus, Error?) -> Void

    Parameters

    error

    The error that occurred, if any.

  • A block to be run with the client secret of a PaymentIntent or SetupIntent.

    Declaration

    Swift

    public typealias STPIntentClientSecretCompletionBlock = (String?, Error?) -> Void

    Parameters

    clientSecret

    The client secret of the PaymentIntent or SetupIntent. See https://stripe.com/docs/api/payment_intents/object#payment_intent_object-client_secret

    error

    The error that occurred when creating the Intent, or nil if none occurred.

  • Completion block typedef for use in STPPaymentHandler methods for Payment Intents.

    Declaration

    Swift

    public typealias STPPaymentHandlerActionPaymentIntentCompletionBlock = (
      STPPaymentHandlerActionStatus, STPPaymentIntent?, NSError?
    ) -> Void
  • Completion block typedef for use in STPPaymentHandler methods for Setup Intents.

    Declaration

    Swift

    public typealias STPPaymentHandlerActionSetupIntentCompletionBlock = (
      STPPaymentHandlerActionStatus, STPSetupIntent?, NSError?
    ) -> Void
  • A callback that is executed when the context believes the redirect action has been completed.

    Declaration

    Swift

    public typealias STPRedirectContextSourceCompletionBlock = (String, String?, Error?) -> Void

    Parameters

    sourceID

    The stripe id of the source.

    clientSecret

    The client secret of the source.

    error

    An error if one occured. Note that a lack of an error does not mean that the action was completed successfully, the presence of one confirms that it was not. Currently the only possible error the context can know about is if SFSafariViewController fails its initial load (e.g. the user has no internet connection, or servers are down).

  • A callback that is executed when the context believes the redirect action has been completed. This type has been renamed to STPRedirectContextSourceCompletionBlock and deprecated.

    Declaration

    Swift

    public typealias STPRedirectContextCompletionBlock = STPRedirectContextSourceCompletionBlock
  • A callback that is executed when the context believes the redirect action has been completed. @note The STPPaymentIntent originally provided to this class may be out of date, so you should re-fetch it using the clientSecret.

    Declaration

    Swift

    public typealias STPRedirectContextPaymentIntentCompletionBlock = (String, Error?) -> Void

    Parameters

    clientSecret

    The client secret of the PaymentIntent.

    error

    An error if one occured. Note that a lack of an error does not mean that the action was completed successfully, the presence of one confirms that it was not. Currently the only possible error the context can know about is if SFSafariViewController fails its initial load (e.g. the user has no internet connection, or servers are down).