WePay iOS SDK  7.0.0-prerelease-1
WPError.h File Reference

WPError.h serves as documentation for all errors surfaced by the WePay iOS SDK. More...

#import <Foundation/Foundation.h>

Go to the source code of this file.

Macros

#define WPUnexpectedErrorMessage   NSLocalizedStringFromTable(@"There was an unexpected error.", @"WePay", @"There was an unexpected error.");
 
#define WPNoDataReturnedErrorMessage   NSLocalizedStringFromTable(@"There was no data returned.", @"WePay", @"There was no data returned.");
 
#define WPCardReaderGeneralErrorMessage   NSLocalizedStringFromTable(@"Swipe failed due to: (a) uneven swipe speed, (b) fast swipe, (c) slow swipe, or (d) damaged card.", @"WePay", @"Swipe failed due to: (a) uneven swipe speed, (b) fast swipe, (c) slow swipe, or (d) damaged card.");
 
#define WPCardReaderInitializationErrorMessage   NSLocalizedStringFromTable(@"Failed to initialize card reader.", @"WePay", @"Failed to initialize card reader.");
 
#define WPCardReaderTimeoutErrorMessage   NSLocalizedStringFromTable(@"Card reader timed out.", @"WePay", @"Card reader timed out.");
 
#define WPSignatureInvalidImageErrorMessage   NSLocalizedStringFromTable(@"Inavlid signature image provided.", @"WePay", @"Inavlid signature image provided.");
 
#define WPNameNotFoundErrorMessage   NSLocalizedStringFromTable(@"Name not found.", @"WePay", @"Name not found.");
 
#define WPInvalidCardDataErrorMessage   NSLocalizedStringFromTable(@"Invalid card data.", @"WePay", @"Invalid card data.");
 
#define WPCardNotSupportedErrorMessage   NSLocalizedStringFromTable(@"This card is not supported.", @"WePay", @"This card is not supported.");
 
#define WPInvalidApplicationIdErrorMessage   NSLocalizedStringFromTable(@"Invalid application ID selected.", @"WePay", @"Invalid application ID selected.");
 
#define WPDeclinedByCardErrorMessage   NSLocalizedStringFromTable(@"The transaction was declined by the card.", @"WePay", @"The transaction was declined by the card.");
 
#define WPCardBlockedErrorMessage   NSLocalizedStringFromTable(@"This card has been blocked.", @"WePay", @"This card has been blocked.");
 
#define WPDeclinedByIssuerErrorMessage   NSLocalizedStringFromTable(@"The transaction was declined by the issuer bank.", @"WePay", @"The transaction was declined by the issuer bank.");
 
#define WPIssuerUnreachableErrorMessage   NSLocalizedStringFromTable(@"The issuing bank could not be reached.", @"WePay", @"The issuing bank could not be reached.");
 
#define WPInvalidAuthInfoErrorMessage   NSLocalizedStringFromTable(@"The provided auth info is invalid.", @"WePay", @"The provided auth info is invalid.");
 
#define WPAuthInfoNotProvidedErrorMessage   NSLocalizedStringFromTable(@"Auth info was not provided.", @"WePay", @"Auth info was not provided.");
 
#define WPPaymentMethodCannotBeTokenizedErrorMessage   NSLocalizedStringFromTable(@"This payment method cannot be tokenized.", @"WePay", @"This payment method cannot be tokenized.");
 
#define WPFailedToGetBatteryLevelErrorMessage   NSLocalizedStringFromTable(@"Battery level could not be determined.", @"WePay", @"Battery level could not be determined.");
 
#define WPCardReaderNotConnectedErrorMessage   NSLocalizedStringFromTable(@"Card reader is not connected.", @"WePay", @"Card reader is not connected.");
 
#define WPCardReaderModelNotSupportedErrorMessage   NSLocalizedStringFromTable(@"This card reader model is not supported.", @"WePay", @"This card reader model is not supported.");
 
#define WPErrorInvalidTransactionAmountErrorMessage   NSLocalizedStringFromTable(@"The provided transaction amount is invalid.", @"WePay", @"The provided transaction amount is invalid.");
 
#define WPErrorInvalidTransactionCurrencyCodeErrorMessage   NSLocalizedStringFromTable(@"The provided currency code is invalid.", @"WePay", @"The provided currency code is invalid.");
 
#define WPErrorInvalidTransactionAccountIDErrorMessage   NSLocalizedStringFromTable(@"The provided account ID is invalid.", @"WePay", @"The provided account ID is invalid.");
 
#define WPErrorInvalidCardReaderSelectionErrorMessage   NSLocalizedStringFromTable(@"Card reader selection is invalid.", @"WePay", @"Card reader selection is invalid.");
 
#define WPErrorCardReaderBatteryTooLowErrorMessage   NSLocalizedStringFromTable(@"The card reader battery does not have enough charge. Please charge before using.", @"WePay", @"The card reader battery does not have enough charge. Please charge before using.");
 
#define WPErrorCardReaderUnableToConnectErrorMessage   NSLocalizedStringFromTable(@"Please make sure you’re using a supported card reader and that it is fully charged.", @"WePay", @"Please make sure you’re using a supported card reader and that it is fully charged.");
 

Enumerations

enum  WPErrorCode {
  WPErrorUnknown = -10000, WPErrorNoDataReturned = -10015, WPErrorCardReaderGeneralError = -10016, WPErrorCardReaderInitialization = -10017,
  WPErrorCardReaderTimeout = -10018, WPErrorCardReaderStatusError = -10019, WPErrorInvalidSignatureImage = -10020, WPErrorNameNotFound = -10021,
  WPErrorInvalidCardData = -10022, WPErrorCardNotSupported = -10023, WPErrorEMVTransactionError = -10024, WPErrorInvalidApplicationId = -10025,
  WPErrorDeclinedByCard = -10026, WPErrorCardBlocked = -10027, WPErrorDeclinedByIssuer = -10028, WPErrorIssuerUnreachable = -10029,
  WPErrorInvalidAuthInfo = -10030, WPErrorAuthInfoNotProvided = -10031, WPErrorPaymentMethodCannotBeTokenized = -10032, WPErrorFailedToGetBatteryLevel = -10033,
  WPErrorCardReaderNotConnected = -10034, WPErrorCardReaderModelNotSupported = -10035, WPErrorInvalidTransactionAmount = -10036, WPErrorInvalidTransactionCurrencyCode = -10037,
  WPErrorInvalidTransactionAccountID = -10038, WPErrorInvalidCardReaderSelection = -10039, WPErrorCardReaderBatteryTooLow = -10040, WPErrorCardReaderUnableToConnect = -10041
}
 

Variables

FOUNDATION_EXPORT NSString *const kWPErrorAPIDomain
 
FOUNDATION_EXPORT NSString *const kWPErrorSDKDomain
 
FOUNDATION_EXPORT NSString *const kWPErrorCategoryKey
 
FOUNDATION_EXPORT NSString *const kWPErrorCategoryNone
 
FOUNDATION_EXPORT NSString *const kWPErrorCategoryCardReader
 
FOUNDATION_EXPORT NSString *const kWPErrorCategoryCardSDK
 
enum WPErrorCode WPErrorCode
 

Detailed Description

WPError.h serves as documentation for all errors surfaced by the WePay iOS SDK.

When errors occur, the WePay iOS SDK returns NSError instances to delegate methods. Each error instance has the following components:

  • [error code] gives the integer code corresponding with the error
  • [error domain] gives the domain that the error belongs to
  • [error userInfo] gives a dictionary with some more useful info, which can be accessed with the keys kWPErrorCategoryKey and NSLocalizedDescriptionKey

The WePay iOS SDK can return errors in various error domains:

  • WePay server API errors are in the kWPErrorAPIDomain
  • Errors generated by the SDK itself are in the kWPErrorSDKDomain
  • System errors generated by iOS are passed through as-is, for example in the NSURLErrorDomain

See the WPErrorCode section for more details about error codes.

Macro Definition Documentation

◆ WPAuthInfoNotProvidedErrorMessage

#define WPAuthInfoNotProvidedErrorMessage   NSLocalizedStringFromTable(@"Auth info was not provided.", @"WePay", @"Auth info was not provided.");

The localizable user facing message for WPErrorAuthInfoNotProvided, that can be retrieved by calling [error localizedDescription].

◆ WPCardBlockedErrorMessage

#define WPCardBlockedErrorMessage   NSLocalizedStringFromTable(@"This card has been blocked.", @"WePay", @"This card has been blocked.");

The localizable user facing message for WPErrorCardBlocked, that can be retrieved by calling [error localizedDescription].

◆ WPCardNotSupportedErrorMessage

#define WPCardNotSupportedErrorMessage   NSLocalizedStringFromTable(@"This card is not supported.", @"WePay", @"This card is not supported.");

The localizable user facing message for WPErrorCardNotSupported, that can be retrieved by calling [error localizedDescription].

◆ WPCardReaderGeneralErrorMessage

#define WPCardReaderGeneralErrorMessage   NSLocalizedStringFromTable(@"Swipe failed due to: (a) uneven swipe speed, (b) fast swipe, (c) slow swipe, or (d) damaged card.", @"WePay", @"Swipe failed due to: (a) uneven swipe speed, (b) fast swipe, (c) slow swipe, or (d) damaged card.");

The localizable user facing message for WPErrorCardReaderGeneralError, that can be retrieved by calling [error localizedDescription].

◆ WPCardReaderInitializationErrorMessage

#define WPCardReaderInitializationErrorMessage   NSLocalizedStringFromTable(@"Failed to initialize card reader.", @"WePay", @"Failed to initialize card reader.");

The localizable user facing message for WPErrorCardReaderInitialization, that can be retrieved by calling [error localizedDescription].

◆ WPCardReaderModelNotSupportedErrorMessage

#define WPCardReaderModelNotSupportedErrorMessage   NSLocalizedStringFromTable(@"This card reader model is not supported.", @"WePay", @"This card reader model is not supported.");

The localizable user facing message for WPErrorCardReaderModelNotSupported, that can be retrieved by calling [error localizedDescription].

◆ WPCardReaderNotConnectedErrorMessage

#define WPCardReaderNotConnectedErrorMessage   NSLocalizedStringFromTable(@"Card reader is not connected.", @"WePay", @"Card reader is not connected.");

The localizable user facing message for WPErrorCardReaderNotConnected, that can be retrieved by calling [error localizedDescription].

◆ WPCardReaderTimeoutErrorMessage

#define WPCardReaderTimeoutErrorMessage   NSLocalizedStringFromTable(@"Card reader timed out.", @"WePay", @"Card reader timed out.");

The localizable user facing message for WPErrorCardReaderTimeout, that can be retrieved by calling [error localizedDescription].

◆ WPDeclinedByCardErrorMessage

#define WPDeclinedByCardErrorMessage   NSLocalizedStringFromTable(@"The transaction was declined by the card.", @"WePay", @"The transaction was declined by the card.");

The localizable user facing message for WPErrorDeclinedByCard, that can be retrieved by calling [error localizedDescription].

◆ WPDeclinedByIssuerErrorMessage

#define WPDeclinedByIssuerErrorMessage   NSLocalizedStringFromTable(@"The transaction was declined by the issuer bank.", @"WePay", @"The transaction was declined by the issuer bank.");

The localizable user facing message for WPErrorDeclinedByIssuer, that can be retrieved by calling [error localizedDescription].

◆ WPErrorCardReaderBatteryTooLowErrorMessage

#define WPErrorCardReaderBatteryTooLowErrorMessage   NSLocalizedStringFromTable(@"The card reader battery does not have enough charge. Please charge before using.", @"WePay", @"The card reader battery does not have enough charge. Please charge before using.");

The localizable user facing message for WPErrorCardReaderBatteryTooLow, that can be retrieved by calling [error localizedDescription].

◆ WPErrorCardReaderUnableToConnectErrorMessage

#define WPErrorCardReaderUnableToConnectErrorMessage   NSLocalizedStringFromTable(@"Please make sure you’re using a supported card reader and that it is fully charged.", @"WePay", @"Please make sure you’re using a supported card reader and that it is fully charged.");

The localizable user facing message for WPErrorCardReaderUnsupportedOrBatteryTooLow, that can be retrieved by calling [error localizedDescription].

◆ WPErrorInvalidCardReaderSelectionErrorMessage

#define WPErrorInvalidCardReaderSelectionErrorMessage   NSLocalizedStringFromTable(@"Card reader selection is invalid.", @"WePay", @"Card reader selection is invalid.");

The localizable user facing message for WPErrorInvalidCardReaderSelection, that can be retrieved by calling [error localizedDescription].

◆ WPErrorInvalidTransactionAccountIDErrorMessage

#define WPErrorInvalidTransactionAccountIDErrorMessage   NSLocalizedStringFromTable(@"The provided account ID is invalid.", @"WePay", @"The provided account ID is invalid.");

The localizable user facing message for WPErrorInvalidTransactionAccountID, that can be retrieved by calling [error localizedDescription].

◆ WPErrorInvalidTransactionAmountErrorMessage

#define WPErrorInvalidTransactionAmountErrorMessage   NSLocalizedStringFromTable(@"The provided transaction amount is invalid.", @"WePay", @"The provided transaction amount is invalid.");

The localizable user facing message for WPErrorInvalidTransactionAmount, that can be retrieved by calling [error localizedDescription].

◆ WPErrorInvalidTransactionCurrencyCodeErrorMessage

#define WPErrorInvalidTransactionCurrencyCodeErrorMessage   NSLocalizedStringFromTable(@"The provided currency code is invalid.", @"WePay", @"The provided currency code is invalid.");

The localizable user facing message for WPErrorInvalidTransactionCurrencyCode, that can be retrieved by calling [error localizedDescription].

◆ WPFailedToGetBatteryLevelErrorMessage

#define WPFailedToGetBatteryLevelErrorMessage   NSLocalizedStringFromTable(@"Battery level could not be determined.", @"WePay", @"Battery level could not be determined.");

The localizable user facing message for WPErrorFailedToGetBatteryLevel, that can be retrieved by calling [error localizedDescription].

◆ WPInvalidApplicationIdErrorMessage

#define WPInvalidApplicationIdErrorMessage   NSLocalizedStringFromTable(@"Invalid application ID selected.", @"WePay", @"Invalid application ID selected.");

The localizable user facing message for WPErrorInvalidApplicationId, that can be retrieved by calling [error localizedDescription].

◆ WPInvalidAuthInfoErrorMessage

#define WPInvalidAuthInfoErrorMessage   NSLocalizedStringFromTable(@"The provided auth info is invalid.", @"WePay", @"The provided auth info is invalid.");

The localizable user facing message for WPErrorInvalidAuthInfo, that can be retrieved by calling [error localizedDescription].

◆ WPInvalidCardDataErrorMessage

#define WPInvalidCardDataErrorMessage   NSLocalizedStringFromTable(@"Invalid card data.", @"WePay", @"Invalid card data.");

The localizable user facing message for WPErrorInvalidCardData, that can be retrieved by calling [error localizedDescription].

◆ WPIssuerUnreachableErrorMessage

#define WPIssuerUnreachableErrorMessage   NSLocalizedStringFromTable(@"The issuing bank could not be reached.", @"WePay", @"The issuing bank could not be reached.");

The localizable user facing message for WPErrorIssuerUnreachable, that can be retrieved by calling [error localizedDescription].

◆ WPNameNotFoundErrorMessage

#define WPNameNotFoundErrorMessage   NSLocalizedStringFromTable(@"Name not found.", @"WePay", @"Name not found.");

The localizable user facing message for WPErrorNameNotFound, that can be retrieved by calling [error localizedDescription].

◆ WPNoDataReturnedErrorMessage

#define WPNoDataReturnedErrorMessage   NSLocalizedStringFromTable(@"There was no data returned.", @"WePay", @"There was no data returned.");

The localizable user facing message for WPErrorNoDataReturned, that can be retrieved by calling [error localizedDescription].

◆ WPPaymentMethodCannotBeTokenizedErrorMessage

#define WPPaymentMethodCannotBeTokenizedErrorMessage   NSLocalizedStringFromTable(@"This payment method cannot be tokenized.", @"WePay", @"This payment method cannot be tokenized.");

The localizable user facing message for WPErrorPaymentMethodCannotBeTokenized, that can be retrieved by calling [error localizedDescription].

◆ WPSignatureInvalidImageErrorMessage

#define WPSignatureInvalidImageErrorMessage   NSLocalizedStringFromTable(@"Inavlid signature image provided.", @"WePay", @"Inavlid signature image provided.");

The localizable user facing message for WPErrorInavlidSignatureImage, that can be retrieved by calling [error localizedDescription].

◆ WPUnexpectedErrorMessage

#define WPUnexpectedErrorMessage   NSLocalizedStringFromTable(@"There was an unexpected error.", @"WePay", @"There was an unexpected error.");

The localizable user facing message for WPErrorUnknown, that can be retrieved by calling [error localizedDescription].

Enumeration Type Documentation

◆ WPErrorCode

Error codes for NSErrors surfaced by the WePay iOS SDK in the kWPErrorSDKDomain. For a full list of error codes in the kWPErrorAPIDomain, visit https://www.wepay.com/developer/reference/errors

Enumerator
WPErrorUnknown 

-10000 Unknown error.

WPErrorNoDataReturned 

-10015 No data returned by the API call.

WPErrorCardReaderGeneralError 

-10016 General error reported by the card reader - usually due to a bad swipe.

WPErrorCardReaderInitialization 

-10017 Error while initializing the card reader.

WPErrorCardReaderTimeout 

-10018 Timeout occurred while waiting for card.

WPErrorCardReaderStatusError 

-10019 Special error reported by card reader - very rare.

WPErrorInvalidSignatureImage 

-10020 Invalid signature image.

WPErrorNameNotFound 

-10021 Name not found.

WPErrorInvalidCardData 

-10022 Invalid card data.

WPErrorCardNotSupported 

-10023 Card not supported.

WPErrorEMVTransactionError 

-10024 EMV transaction error.

WPErrorInvalidApplicationId 

-10025 Invalid application ID.

WPErrorDeclinedByCard 

-10026 Declined by card.

WPErrorCardBlocked 

-10027 Card blocked.

WPErrorDeclinedByIssuer 

-10028 Declined by issuer.

WPErrorIssuerUnreachable 

-10029 Issuer unreachable.

WPErrorInvalidAuthInfo 

-10030 Invalid auth info.

WPErrorAuthInfoNotProvided 

-10031 Auth info not provided.

WPErrorPaymentMethodCannotBeTokenized 

-10032 Payment method cannot be tokenized.

WPErrorFailedToGetBatteryLevel 

-10033 Failed to get battery level.

WPErrorCardReaderNotConnected 

-10034 Card reader not connected.

WPErrorCardReaderModelNotSupported 

-10035 Card reader model not supported.

WPErrorInvalidTransactionAmount 

-10036 Invalid transaction amount.

WPErrorInvalidTransactionCurrencyCode 

-10037 Invalid transaction currency code.

WPErrorInvalidTransactionAccountID 

-10038 Invalid transaction account id.

WPErrorInvalidCardReaderSelection 

-10039 Invalid card reader selection.

WPErrorCardReaderBatteryTooLow 

-10040 Card reader battery too low.

WPErrorCardReaderUnableToConnect 

-10041 Unable to connect to card reader.

Variable Documentation

◆ kWPErrorAPIDomain

FOUNDATION_EXPORT NSString* const kWPErrorAPIDomain

The NSError domain of all errors surfaced by the WePay iOS SDK that were returned by the WePay API. For a full list of error codes in the kWPErrorAPIDomain, visit https://www.wepay.com/developer/reference/errors

◆ kWPErrorCategoryCardReader

FOUNDATION_EXPORT NSString* const kWPErrorCategoryCardReader

The value used in the NSError's userInfo dictionary to return the "card reader" error category.

◆ kWPErrorCategoryCardSDK

FOUNDATION_EXPORT NSString* const kWPErrorCategoryCardSDK

The value used in the NSError's userInfo dictionary to return the "sdk" error category.

◆ kWPErrorCategoryKey

FOUNDATION_EXPORT NSString* const kWPErrorCategoryKey

The key used in the NSError's userInfo dictionary to return the error category.

◆ kWPErrorCategoryNone

FOUNDATION_EXPORT NSString* const kWPErrorCategoryNone

The value used in the NSError's userInfo dictionary to return the "none" error category.

◆ kWPErrorSDKDomain

FOUNDATION_EXPORT NSString* const kWPErrorSDKDomain

The NSError domain of all errors returned by the WePay iOS SDK itself. For a full list of error codes in the kWPErrorSDKDomain, look at WPErrorCode.