Enum ErrorCode

Source
pub enum ErrorCode {
Show 137 variants InternalServerError, Unauthorized, AccessTokenExpired, AccessTokenRevoked, ClientDisabled, Forbidden, InsufficientScopes, 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, InvalidPauseLength, InvalidDate, CardExpired, InvalidExpiration, InvalidExpirationYear, InvalidExpirationDate, UnsupportedCardBrand, UnsupportedEntryMethod, InvalidEncryptedCard, InvalidCard, 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, InvalidCardData, SourceUsed, SourceExpired, UnsupportedLoyaltyRewardTier, LocationMismatch, IdempotencyKeyReused, UnexpectedValue, SandboxNotSupported, InvalidEmailAddress, InvalidPhoneNumber, CheckoutExpired, BadCertificate, InvalidSquareVersionFormat, ApiVersionIncompatible, CardDeclined, VerifyCvvFailure, VerifyAvsFailure, CardDeclinedCallIssure, CardDeclinedVerificationRequired, BadExpiration, ChipInsertionRequired, AllowablePinTriesExceeded, ReservationDeclined, NotFound, ApplePaymentProcessingCertificateHashNotFound, MethodNotAllowed, NotAcceptable, RequestTimeout, Conflict, Gone, RequestEntityTooLarge, UnsupportedMediaType, UnprocessableEntity, RateLimited, NotImplemented, BadGateway, ServiceUnavailable, TemporaryError, GatewayTimeout,
}
Expand description

Indicates which high-level category of error has occurred during a request to the Connect API.

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.

§

InsufficientScopes

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.

§

InvalidPauseLength

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

§

InvalidDate

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

§

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.

§

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.

§

PanFailure

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

§

ExpirationFailure

The card expiration date is either invalid or indicates that the card is expired.

§

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 payment.

§

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, a previous refund has already been rejected and no new refunds can be accepted.

§

RefundDeclined

Request failed - The card issuer declined the 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 tier is not supported. This could 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.

§

CardDeclined

The card was declined.

§

VerifyCvvFailure

The CVV could not be verified.

§

VerifyAvsFailure

The AVS could not be verified.

§

CardDeclinedCallIssure

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.

§

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§

const 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 PartialEq for ErrorCode

Source§

fn eq(&self, other: &ErrorCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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
Source§

impl Eq for ErrorCode

Source§

impl StructuralPartialEq for ErrorCode

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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,