SCPApiError
Objective-C
@interface SCPApiError : NSObject <NSCopying>
Swift
class ApiError : NSObject, NSCopying
An API error returned by Stripe when a request fails.
-
The type of error returned.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *type;Swift
var type: String? { get } -
ID of failed charge, if applicable.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *charge;Swift
var charge: String? { get } -
For some errors that could be handled programmatically, a short string indicating the error code reported.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *code;Swift
var code: String? { get } -
For card errors resulting from a card issuer decline, a short string indicating the card issuer’s reason for the decline if they provide one.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *declineCode;Swift
var declineCode: String? { get } -
A URL to more information about the error code reported.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *docUrl;Swift
var docUrl: String? { get } -
A human-readable message providing more details about the error. For card errors (
type==card_error), these messages can be shown to your users.When an
SCPLocaleConfigis set, this message may be returned in a non-English locale. InspectlocalizationResultto determine the locale of the message. Avoid relying on message content for application logic, since the content may change.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *message;Swift
var message: String? { get } -
If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *param;Swift
var param: String? { get } -
A URL to the request log entry in your dashboard.
For ApiErrors returned from smart readers, a minimum version of 2.41 is required for this field to be populated.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *requestLogUrl;Swift
var requestLogUrl: String? { get } -
For payments declined by the network, an alphanumeric code which indicates the reason the payment failed.
For ApiErrors returned from smart readers, a minimum version of 2.41 is required for this field to be populated.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *networkDeclineCode;Swift
var networkDeclineCode: String? { get } -
For card errors resulting from a card issuer decline, a short string indicating how to proceed with an error if they provide one.
For ApiErrors returned from smart readers, a minimum version of 2.41 is required for this field to be populated.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *adviceCode;Swift
var adviceCode: String? { get } -
For card errors resulting from a card issuer decline, a 2 digit code which indicates the advice given to merchant by the card network on how to proceed with an error.
For ApiErrors returned from smart readers, a minimum version of 2.41 is required for this field to be populated.
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *networkAdviceCode;Swift
var networkAdviceCode: String? { get } -
Reports the outcome of localizing
message.This is nil when:
- The
SCPApiErrorwas constructed locally by the SDK rather than from a server response. - The
SCPApiErrorcame from a smart reader running a version below 2.43.
Declaration
Objective-C
@property (nonatomic, strong, readonly, nullable) SCPLocalizationResult *localizationResult;Swift
var localizationResult: SCPLocalizationResult? { get } - The
-
Unavailable
You cannot directly instantiate this class. You should only use ApiErrors that have been returned by other methods in our SDK.
Declaration
Objective-C
- (nonnull instancetype)init; -
Unavailable
You cannot directly instantiate this class. You should only use ApiErrors that have been returned by other methods in our SDK.
Declaration
Objective-C
+ (nonnull instancetype)new;