Enum ErrorCode

Source
pub enum ErrorCode {
Show 149 variants InternalServerError, UnAuthorized, AccessTokenExpired, AccessTokenRevoked, ClientDisabled, ForBidden, InsufficientScope, ApplicationDisabled, V1Application, V1AccessToken, CardProcessingNotEnabled, MerchantSubscriptionNotFound, BadRequest, MissingRequiredParameter, IncorrectType, InvalidTime, InvalidTimeRange, InvalidValue, InvalidCursor, UnknownQueryParameter, ConflictingParameters, ExpectedJSONBody, InvalidSortOrder, ValueRegexMismatch, ValueTooShort, ValueTooLong, ValueTooLow, ValueTooHigh, ValueEmpty, ArrayLengthTooLong, ArrayLengthTooShort, ArrayEmpty, ExpectedBoolean, ExpectedInteger, ExpectedFloat, ExpectedString, ExpectedObject, ExpectedArray, ExpectedMap, ExpectedBase64EncodedByteArray, InvalidArrayValue, InvalidEnumValue, InvalidContentType, InvalidFormValue, CustomerNotFound, OneInstrumentExpected, NoFieldsSet, TooManyMapEntries, MapKeyLengthTooShort, MapKeyLengthTooLong, CustomerMissingName, CustomerMissingEmail, InvalidPauseLenghth, InvalidDate, UnsupportedCountry, UnsupportedCurrency, AppleTipPinToken, CardExpired, InvalidExpiration, InvalidExpirationYear, InvalidExpirationDate, UnsupportedCardBrand, UnsupportedEntryMethod, InvalidEncryptedCard, InvalidCard, PaymentAmountMismatch, GenericDecline, CvvFailure, AddressVerificationFailure, InvalidAccount, CurrencyMismatch, InsufficientFunds, InsufficientPermissions, CardholderInsufficientPermissions, InvalidLocation, TransactionLimit, VoiceFailure, PanFailure, ExpirationFailure, CardNotSupported, InvalidPin, MissingPin, MissingAccountType, InvalidPostalCode, InvalidFees, ManuallyEnteredPaymentNotSupported, PaymentLimitExceeded, GiftCardAvailableAmount, AccountUnusable, BuyerRefusedPayment, DelayedTransactionExpired, DelayedTransactionCanceled, DelayedTransactionCaptured, DelayedTransactionFailed, CardTokenExpired, CardTokenUsed, AmountTooHigh, UnsupportedInstrumentType, RefundAmountInvalid, RefundAlreadyPending, PaymentNotRefundable, RefundDeclined, InsufficientPermissionsForRefund, InvalidCardData, SourceUsed, SourceExpired, UnsupportedLoyaltyRewardTier, LocationMismatch, IdempotencyKeyReused, UnexpectedValue, SandboxNotSupported, InvalidEmailAddress, InvalidPhoneNumber, CheckoutExpired, BadCertificate, InvalidSquareVersionFormat, ApiVersionIncompatible, CardPresenceRequired, UnsupportedSourceType, CardMismatch, PlaidError, PlaidErrorItemLoginRequired, PlaidErrorRateLimit, CardDeclined, VerifyCvvFailure, VerifyAvsFailure, CardDeclinedCallIssuer, CardDeclinedVerificationRequired, BadExpiration, ChipInsertionRequired, AllowablePinTriesExceeded, ReservationDeclined, UnknownBodyParameter, NotFound, ApplePaymentProcessingCertificateHashNotFound, MethodNotAllowed, NotAcceptable, RequestTimeout, Conflict, Gone, RequestEntityTooLarge, UnsupportedMediaType, UnprocessableEntity, RateLimited, NotImplemented, BadGateway, ServiceUnavailable, TemporaryError, GatewayTimeout,
}
Expand description

The specific code of the error.

Variants§

§

InternalServerError

A general server error occurred.

§

UnAuthorized

A general authorization error occurred.

§

AccessTokenExpired

The provided access token has expired.

§

AccessTokenRevoked

The provided access token has been revoked.

§

ClientDisabled

The provided client has been disabled.

§

ForBidden

A general access error occurred.

§

InsufficientScope

The provided access token does not have permission to execute the requested action.

§

ApplicationDisabled

The calling application was disabled.

§

V1Application

The calling application was created prior to 2016-03-30 and is not compatible with v2 Square API calls.

§

V1AccessToken

The calling application is using an access token created prior to 2016-03-30 and is not compatible with v2 Square API calls.

§

CardProcessingNotEnabled

The location provided in the API call is not enabled for credit card processing.

§

MerchantSubscriptionNotFound

A required subscription was not found for the merchant

§

BadRequest

A general error occurred with the request.

§

MissingRequiredParameter

The request is missing a required path, query, or body parameter.

§

IncorrectType

The value provided in the request is the wrong type. For example, a string instead of an integer.

§

InvalidTime

Formatting for the provided time value is incorrect.

§

InvalidTimeRange

The time range provided in the request is invalid. For example, the end time is before the start time.

§

InvalidValue

The provided value is invalid. For example, including % in a phone number.

§

InvalidCursor

The pagination cursor included in the request is invalid.

§

UnknownQueryParameter

The query parameters provided is invalid for the requested endpoint.

§

ConflictingParameters

One or more of the request parameters conflict with each other.

§

ExpectedJSONBody

The request body is not a JSON object.

§

InvalidSortOrder

The provided sort order is not a valid key. Currently, sort order must be ASC or DESC.

§

ValueRegexMismatch

The provided value does not match an expected regular expression.

§

ValueTooShort

The provided string value is shorter than the minimum length allowed.

§

ValueTooLong

The provided string value is longer than the maximum length allowed.

§

ValueTooLow

The provided value is less than the supported minimum.

§

ValueTooHigh

The provided value is greater than the supported maximum.

§

ValueEmpty

The provided value has a default (empty) value such as a blank string.

§

ArrayLengthTooLong

The provided array has too many elements.

§

ArrayLengthTooShort

The provided array has too few elements.

§

ArrayEmpty

The provided array is empty.

§

ExpectedBoolean

The endpoint expected the provided value to be a boolean.

§

ExpectedInteger

The endpoint expected the provided value to be an integer.

§

ExpectedFloat

The endpoint expected the provided value to be a float.

§

ExpectedString

The endpoint expected the provided value to be a string.

§

ExpectedObject

The endpoint expected the provided value to be a JSON object.

§

ExpectedArray

The endpoint expected the provided value to be an array or list.

§

ExpectedMap

The endpoint expected the provided value to be a map or associative array.

§

ExpectedBase64EncodedByteArray

The endpoint expected the provided value to be an array encoded in base64.

§

InvalidArrayValue

One or more objects in the array does not match the array type.

§

InvalidEnumValue

The provided static string is not valid for the field.

§

InvalidContentType

Invalid content type header.

§

InvalidFormValue

Only relevant for applications created prior to 2016-03-30. Indicates there was an error while parsing form values.

§

CustomerNotFound

The provided customer id can’t be found in the merchant’s customers list.

§

OneInstrumentExpected

A general error occurred.

§

NoFieldsSet

A general error occurred.

§

TooManyMapEntries

Too many entries in the map field.

§

MapKeyLengthTooShort

The length of one of the provided keys in the map is too short.

§

MapKeyLengthTooLong

The length of one of the provided keys in the map is too long.

§

CustomerMissingName

The provided customer does not have a recorded name.

§

CustomerMissingEmail

The provided customer does not have a recorded email.

§

InvalidPauseLenghth

The subscription cannot be paused longer than the duration of the current phase.

§

InvalidDate

The subscription cannot be paused/resumed on the given date.

§

UnsupportedCountry

The API request references an unsupported country.

§

UnsupportedCurrency

The API request references an unsupported currency.

§

AppleTipPinToken

The payment was declined by the card issuer during an Apple Tap to Pay (TTP) transaction with a request for the card’s PIN. This code will be returned alongside CARD_DECLINED_VERIFICATION_REQUIRED as a supplemental error, and will include an issuer-provided token in the details field that is needed to initiate the PIN collection flow on the iOS device.

§

CardExpired

The card issuer declined the request because the card is expired.

§

InvalidExpiration

The expiration date for the payment card is invalid. For example, it indicates a date in the past.

§

InvalidExpirationYear

The expiration year for the payment card is invalid. For example, it indicates a year in the past or contains invalid characters.

§

InvalidExpirationDate

The expiration date for the payment card is invalid. For example, it contains invalid characters.

§

UnsupportedCardBrand

The credit card provided is not from a supported issuer.

§

UnsupportedEntryMethod

The entry method for the credit card (swipe, dip, tap) is not supported.

§

InvalidEncryptedCard

The encrypted card information is invalid.

§

InvalidCard

The credit card cannot be validated based on the provided details.

§

PaymentAmountMismatch

The payment was declined because there was a payment amount mismatch. The money amount Square was expecting does not match the amount provided.

§

GenericDecline

Square received a decline without any additional information. If the payment information seems correct, the buyer can contact their issuer to ask for more information.

§

CvvFailure

The card issuer declined the request because the CVV value is invalid.

§

AddressVerificationFailure

The card issuer declined the request because the postal code is invalid.

§

InvalidAccount

The issuer was not able to locate the account on record.

§

CurrencyMismatch

The currency associated with the payment is not valid for the provided funding source. For example, a gift card funded in USD cannot be used to process payments in GBP.

§

InsufficientFunds

The funding source has insufficient funds to cover the payment.

§

InsufficientPermissions

The Square account does not have the permissions to accept this payment. For example, Square may limit which merchants are allowed to receive gift card payments.

§

CardholderInsufficientPermissions

The card issuer has declined the transaction due to restrictions on where the card can be used. For example, a gift card is limited to a single merchant.

§

InvalidLocation

The Square account cannot take payments in the specified region. A Square account can take payments only from the region where the account was created.

§

TransactionLimit

The card issuer has determined the payment amount is either too high or too low. The API returns the error code mostly for credit cards (for example, the card reached the credit limit). However, sometimes the issuer bank can indicate the error for debit or prepaid cards (for example, card has insufficient funds).

§

VoiceFailure

The card issuer declined the request because the issuer requires voice authorization from the cardholder. The seller should ask the customer to contact the card issuing bank to authorize the payment.

§

PanFailure

The specified card number is invalid. For example, it is of incorrect length or is incorrectly formatted.

§

ExpirationFailure

The card issuer declined the request because the PIN is invalid.

§

CardNotSupported

The card is not supported either in the geographic region or by the merchant category code (MCC).

§

InvalidPin

The card issuer declined the request because the PIN is invalid.

§

MissingPin

The payment is missing a required PIN.

§

MissingAccountType

The payment is missing a required ACCOUNT_TYPE parameter.

§

InvalidPostalCode

The postal code is incorrectly formatted.

§

InvalidFees

The app_fee_money on a payment is too high.

§

ManuallyEnteredPaymentNotSupported

The card must be swiped, tapped, or dipped. Payments attempted by manually entering the card number are declined.

§

PaymentLimitExceeded

Square declined the request because the payment amount exceeded the processing limit for this merchant.

§

GiftCardAvailableAmount

When a Gift Card is a payment source, you can allow taking a partial payment by adding the accept_partial_authorization parameter in the request. However, taking such a partial payment does not work if your request also includes tip_money, app_fee_money, or both. Square declines such payments and returns the GIFT_CARD_AVAILABLE_AMOUNT error. For more information, see CreatePayment errors (additional information).

§

AccountUnusable

The account provided cannot carry out transactions.

§

BuyerRefusedPayment

Bank account rejected or was not authorized for the payment.

§

DelayedTransactionExpired

The application tried to update a delayed-capture payment that has expired.

§

DelayedTransactionCanceled

The application tried to cancel a delayed-capture payment that was already cancelled.

§

DelayedTransactionCaptured

The application tried to capture a delayed-capture payment that was already captured.

§

DelayedTransactionFailed

The application tried to update a delayed-capture payment that failed.

§

CardTokenExpired

The provided card token (nonce) has expired.

§

CardTokenUsed

The provided card token (nonce) was already used to process the payment or refund.

§

AmountTooHigh

The requested payment amount is too high for the provided payment source.

§

UnsupportedInstrumentType

The API request references an unsupported instrument type.

§

RefundAmountInvalid

The requested refund amount exceeds the amount available to refund.

§

RefundAlreadyPending

The payment already has a pending refund.

§

PaymentNotRefundable

The payment is not refundable. For example, the payment has been disputed and is no longer eligible for refunds.

§

RefundDeclined

Request failed - The card issuer declined the refund.

§

InsufficientPermissionsForRefund

The Square account does not have the permissions to process this refund.

§

InvalidCardData

Generic error - the provided card data is invalid.

§

SourceUsed

The provided source id was already used to create a card.

§

SourceExpired

The provided source id has expired.

§

UnsupportedLoyaltyRewardTier

The referenced loyalty program reward ties is not supported. This cloud happen if the reward tier created in a first party application is incompatible with the Loyalty API.

§

LocationMismatch

Generic error - the given location does not matching what is expected.

§

IdempotencyKeyReused

The provided idempotency key has already been used.

§

UnexpectedValue

General error - the value provided was unexpected.

§

SandboxNotSupported

The API request is not supported in sandbox.

§

InvalidEmailAddress

The provided email address is invalid.

§

InvalidPhoneNumber

The provided phone number is invalid.

§

CheckoutExpired

The provided checkout URL has expired.

§

BadCertificate

Bad certificate.

§

InvalidSquareVersionFormat

The provided Square-Version is incorrectly formatted.

§

ApiVersionIncompatible

The provided Square-Version is incompatible with the requested action.

§

CardPresenceRequired

The transaction requires that a card be present.

§

UnsupportedSourceType

The API request references an unsupported source type.

§

CardMismatch

The provided card does not match what is expected.

§

PlaidError

Generic plaid error

§

PlaidErrorItemLoginRequired

Plaid error - ITEM_LOGIN_REQUIRED

§

PlaidErrorRateLimit

Plaid error - RATE_LIMIT

§

CardDeclined

The card was declined.

§

VerifyCvvFailure

The CVV could not be verified.

§

VerifyAvsFailure

The AVS could not be verified.

§

CardDeclinedCallIssuer

The payment card was declined with a request for the card holder to call the issuer.

§

CardDeclinedVerificationRequired

The payment card was declined with a request for additional verification.

§

BadExpiration

The card expiration date is either missing or incorrectly formatted.

§

ChipInsertionRequired

The card issuer requires that the card be read using a chip reader.

§

AllowablePinTriesExceeded

The card has exhausted its available pin entry retries set by the card issuer. Resolving the error typically requires the card holder to contact the card issuer.

§

ReservationDeclined

The card issuer declined the refund.

§

UnknownBodyParameter

The body parameter is not recognized by the requested endpoint.

§

NotFound

Not Found - a general error occurred.

§

ApplePaymentProcessingCertificateHashNotFound

Square could not find the associated Apple Pay certificate.

§

MethodNotAllowed

Method Not Allowed - a general error occurred.

§

NotAcceptable

Not Acceptable - a general error occurred.

§

RequestTimeout

Request Timeout - a general error occurred.

§

Conflict

Conflict - a general error occurred.

§

Gone

The target resource is no longer available and this condition is likely to be permanent.

§

RequestEntityTooLarge

Request Entity Too Large - a general error occurred.

§

UnsupportedMediaType

Unsupported Media Type - a general error occurred.

§

UnprocessableEntity

Unprocessable Entity - a general error occurred.

§

RateLimited

Rate Limited - a general error occurred.

§

NotImplemented

Not Implemented - a general error occurred.

§

BadGateway

Bad Gateway - a general error occurred.

§

ServiceUnavailable

Service Unavailable - a general error occurred.

§

TemporaryError

A temporary internal error occurred. You can safely retry your call using the same idempotency key.

§

GatewayTimeout

Gateway Timeout - a general error occurred.

Trait Implementations§

Source§

impl Clone for ErrorCode

Source§

fn clone(&self) -> ErrorCode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ErrorCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ErrorCode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ErrorCode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,