#[non_exhaustive]pub enum ErrorReason {
Show 25 variants
InsufficientFunds,
InvalidExactEvmPayloadAuthorizationValidAfter,
InvalidExactEvmPayloadAuthorizationValidBefore,
InvalidExactEvmPayloadAuthorizationValueMismatch,
InvalidExactEvmPayloadSignature,
InvalidExactEvmPayloadRecipientMismatch,
InvalidNetwork,
InvalidPayload,
InvalidPaymentRequirements,
InvalidScheme,
UnsupportedScheme,
InvalidX402Version,
InvalidTransactionState,
UnexpectedVerifyError,
UnexpectedSettleError,
DuplicateSettlement,
NonceAlreadyUsed,
Permit2AllowanceRequired,
InvalidUptoEvmPayloadSettlementExceedsAmount,
UptoFacilitatorMismatch,
UptoUnauthorizedFacilitator,
UptoAmountExceedsPermitted,
InvalidExactSolanaPayloadMemoMismatch,
InvalidExactSolanaPayloadMemoCount,
Custom(CompactString),
}Expand description
Canonical error code returned on the wire when a payment fails.
The variants form a closed set of well-known codes the SDK can pattern
match against. Any unknown wire code is preserved via Self::Custom
so deserialisation is total and idempotent.
The enum is #[non_exhaustive]: new well-known variants may be added
in minor releases without breaking semver.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InsufficientFunds
Client does not have enough tokens to complete the payment.
Wire code: insufficient_funds.
InvalidExactEvmPayloadAuthorizationValidAfter
Payment authorization is not yet valid (before validAfter timestamp).
Wire code: invalid_exact_evm_payload_authorization_valid_after.
InvalidExactEvmPayloadAuthorizationValidBefore
Payment authorization has expired (after validBefore timestamp).
Wire code: invalid_exact_evm_payload_authorization_valid_before.
InvalidExactEvmPayloadAuthorizationValueMismatch
Payment amount does not exactly match the required amount.
Wire code: invalid_exact_evm_payload_authorization_value_mismatch.
InvalidExactEvmPayloadSignature
Payment authorization signature is invalid or improperly signed.
Wire code: invalid_exact_evm_payload_signature.
InvalidExactEvmPayloadRecipientMismatch
Recipient address does not match payment requirements.
Wire code: invalid_exact_evm_payload_recipient_mismatch.
InvalidNetwork
Specified blockchain network is not supported.
Wire code: invalid_network.
InvalidPayload
Payment payload is malformed or contains invalid data.
Wire code: invalid_payload.
InvalidPaymentRequirements
Payment requirements object is invalid or malformed.
Wire code: invalid_payment_requirements.
InvalidScheme
Specified payment scheme is not supported.
Wire code: invalid_scheme.
UnsupportedScheme
Payment scheme is not supported by the facilitator.
Wire code: unsupported_scheme.
InvalidX402Version
Protocol version is not supported.
Wire code: invalid_x402_version.
InvalidTransactionState
Blockchain transaction failed or was rejected.
Wire code: invalid_transaction_state.
UnexpectedVerifyError
Unexpected error occurred during payment verification.
Wire code: unexpected_verify_error.
UnexpectedSettleError
Unexpected error occurred during payment settlement.
Wire code: unexpected_settle_error.
DuplicateSettlement
Facilitator detected a duplicate settlement attempt and rejected it.
Wire code: duplicate_settlement.
NonceAlreadyUsed
EIP-3009 authorization nonce has already been consumed on-chain.
Wire code: nonce_already_used.
Permit2AllowanceRequired
Permit2 allowance is insufficient; the payer must call approve
on the token contract pointing at the Permit2 address first.
Wire code: permit2_allowance_required.
HTTP mapping: 412 Precondition Failed.
InvalidUptoEvmPayloadSettlementExceedsAmount
Resource server requested a settlement amount exceeding the buyer’s
signed maximum authorisation. Reserved by
schemes/upto/scheme_upto_evm.md §4.
Wire code: invalid_upto_evm_payload_settlement_exceeds_amount.
UptoFacilitatorMismatch
witness.facilitator doesn’t match any of the facilitator’s signer
addresses. Buyer signed a stale or unauthorised facilitator address.
Wire code: upto_facilitator_mismatch.
On-chain proxy reverted with UnauthorizedFacilitator (msg.sender
is not the witness-bound facilitator).
Wire code: upto_unauthorized_facilitator.
UptoAmountExceedsPermitted
On-chain proxy reverted with AmountExceedsPermitted.
Wire code: upto_amount_exceeds_permitted.
InvalidExactSolanaPayloadMemoMismatch
SVM extra.memo field did not match the memo instruction data.
Wire code: invalid_exact_solana_payload_memo_mismatch.
InvalidExactSolanaPayloadMemoCount
Number of memo instructions attached is invalid (spec requires
exactly one when extra.memo is declared).
Wire code: invalid_exact_solana_payload_memo_count.
Custom(CompactString)
Catch-all preserving any unknown wire code verbatim. Round-trips losslessly through serialisation so clients never lose information.
Implementations§
Source§impl ErrorReason
impl ErrorReason
Sourcepub fn from_wire(code: &str) -> Self
pub fn from_wire(code: &str) -> Self
Constructs an ErrorReason from any wire code, mapping known
strings to their canonical variants and preserving unknown codes
as Self::Custom.
Trait Implementations§
Source§impl Clone for ErrorReason
impl Clone for ErrorReason
Source§fn clone(&self) -> ErrorReason
fn clone(&self) -> ErrorReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ErrorReason
impl Debug for ErrorReason
Source§impl<'de> Deserialize<'de> for ErrorReason
impl<'de> Deserialize<'de> for ErrorReason
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for ErrorReason
impl Display for ErrorReason
impl Eq for ErrorReason
Source§impl From<&str> for ErrorReason
impl From<&str> for ErrorReason
Source§impl From<CompactString> for ErrorReason
impl From<CompactString> for ErrorReason
Source§fn from(value: CompactString) -> Self
fn from(value: CompactString) -> Self
Source§impl From<String> for ErrorReason
impl From<String> for ErrorReason
Source§impl Hash for ErrorReason
impl Hash for ErrorReason
Source§impl PartialEq for ErrorReason
impl PartialEq for ErrorReason
Source§impl Serialize for ErrorReason
impl Serialize for ErrorReason
impl StructuralPartialEq for ErrorReason
Auto Trait Implementations§
impl Freeze for ErrorReason
impl RefUnwindSafe for ErrorReason
impl Send for ErrorReason
impl Sync for ErrorReason
impl Unpin for ErrorReason
impl UnsafeUnpin for ErrorReason
impl UnwindSafe for ErrorReason
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more