Type Definitions
The following type definitions are available globally.
-
Constants that represent different parts of a users contact/address information.
Declaration
Objective-C
typedef NSString *STPContactField
Swift
struct STPContactField : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable
-
An empty block, called with no arguments, returning nothing.
Declaration
Objective-C
typedef void (^STPVoidBlock)(void)
Swift
typealias STPVoidBlock = () -> Void
-
A block that may optionally be called with an error.
Declaration
Objective-C
typedef void (^STPErrorBlock)(NSError *_Nullable)
Swift
typealias STPErrorBlock = (Error?) -> Void
Parameters
error
The error that occurred, if any.
-
A callback to be run with a JSON response.
Declaration
Objective-C
typedef void (^STPJSONResponseCompletionBlock)(NSDictionary *_Nullable, NSError *_Nullable)
Swift
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
Objective-C
typedef void (^STPTokenCompletionBlock)(STPToken *_Nullable, NSError *_Nullable)
Swift
typealias STPTokenCompletionBlock = (STPToken?, Error?) -> Void
Parameters
token
The Stripe token from the response. Will be nil if an error occurs. - see: STPToken
error
The error returned from the response, or nil if none occurs. - see: StripeError.h for possible values.
-
A callback to be run with a source response from the Stripe API.
Declaration
Objective-C
typedef void (^STPSourceCompletionBlock)(STPSource *_Nullable, NSError *_Nullable)
Swift
typealias STPSourceCompletionBlock = (STPSource?, Error?) -> Void
Parameters
source
The Stripe source from the response. Will be nil if an error occurs. - see: STPSource
error
The error returned from the response, or nil if none occurs. - see: StripeError.h for possible values.
-
A callback to be run with a source or card response from the Stripe API.
Declaration
Objective-C
typedef void (^STPSourceProtocolCompletionBlock)( id<STPSourceProtocol> _Nullable, NSError *_Nullable)
Parameters
source
The Stripe source from the response. Will be nil if an error occurs. - see: STPSourceProtocol
error
The error returned from the response, or nil if none occurs. - see: StripeError.h for possible values.
-
A callback to be run with a PaymentIntent response from the Stripe API.
Declaration
Objective-C
typedef void (^STPPaymentIntentCompletionBlock)(STPPaymentIntent *_Nullable, NSError *_Nullable)
Swift
typealias STPPaymentIntentCompletionBlock = (STPPaymentIntent?, Error?) -> Void
Parameters
paymentIntent
The Stripe PaymentIntent from the response. Will be nil if an error occurs. - see: STPPaymentIntent
error
The error returned from the response, or nil if none occurs. - see: StripeError.h for possible values.
-
A callback to be run with a PaymentMethod response from the Stripe API.
Declaration
Objective-C
typedef void (^STPPaymentMethodCompletionBlock)(STPPaymentMethod *_Nullable, NSError *_Nullable)
Swift
typealias STPPaymentMethodCompletionBlock = (STPPaymentMethod?, Error?) -> Void
Parameters
paymentMethod
The Stripe PaymentMethod from the response. Will be nil if an error occurs. - see: STPPaymentMethod
error
The error returned from the response, or nil if none occurs. - see: StripeError.h for possible values.
-
A callback to be run with a validation result and shipping methods for a shipping address.
Declaration
Objective-C
typedef void (^STPShippingMethodsCompletionBlock)( STPShippingStatus, NSError *_Nullable, NSArray<PKShippingMethod *> *_Nullable, PKShippingMethod *_Nullable)
Swift
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
Objective-C
typedef void (^STPFileCompletionBlock)(STPFile *_Nullable, NSError *_Nullable)
Swift
typealias STPFileCompletionBlock = (STPFile?, Error?) -> Void
Parameters
file
The Stripe file from the response. Will be nil if an error occurs. - see: STPFile
error
The error returned from the response, or nil if none occurs. - see: StripeError.h for possible values.
-
A callback to be run with a customer response from the Stripe API.
Declaration
Objective-C
typedef void (^STPCustomerCompletionBlock)(STPCustomer *_Nullable, NSError *_Nullable)
Swift
typealias STPCustomerCompletionBlock = (STPCustomer?, Error?) -> Void
Parameters
customer
The Stripe customer from the response, or nil if an error occurred. - see: STPCustomer
error
The error returned from the response, or nil if none occurs.
-
Deprecated
Use STPPaymentIntentAction instead
Source Action details for an STPPaymentIntent. This is a container for the various types that are available. Check the
type
to see which one it is, and then use the related property for the details necessary to handle it.@deprecated Use
STPPaymentIntentAction
instead.Declaration
Objective-C
typedef STPPaymentIntentAction STPPaymentIntentSourceAction
-
Deprecated
Use STPPaymentIntentActionRedirectToURL instead
The
STPPaymentIntentSourceAction
details when type isSTPPaymentIntentSourceActionTypeAuthorizeWithURL
.These are created & owned by the containing
STPPaymentIntent
.@deprecated Use
STPPaymentIntentActionRedirectToURL
instead.Declaration
Objective-C
typedef STPPaymentIntentActionRedirectToURL STPPaymentIntentSourceActionAuthorizeWithURL
-
A callback that is executed when the context believes the redirect action has been completed.
Declaration
Objective-C
typedef void (^STPRedirectContextSourceCompletionBlock)(NSString *_Nonnull, NSString *_Nullable, NSError *_Nullable)
Swift
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).
-
Deprecated
STPRedirectContextCompletionBlock has been renamed to STPRedirectContextSourceCompletionBlock
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
Objective-C
typedef STPRedirectContextSourceCompletionBlock STPRedirectContextCompletionBlock
Swift
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
Objective-C
typedef void (^STPRedirectContextPaymentIntentCompletionBlock)( NSString *_Nonnull, NSError *_Nullable)
Swift
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).
-
Possible string values you may receive when there was an error tokenizing a card. These values will come back in the error
userInfo
dictionary under theSTPCardErrorCodeKey
key.Declaration
Objective-C
typedef NSString *STPCardErrorCode
Swift
struct STPCardErrorCode : _ObjectiveCBridgeable, Hashable, Equatable, _SwiftNewtypeWrapper, RawRepresentable