pub struct X402V2PaymentRequirements {
pub amount: String,
pub asset: BlockchainAddress,
pub extra: Map<String, Value>,
pub max_timeout_seconds: i64,
pub network: X402v2Network,
pub pay_to: BlockchainAddress,
pub scheme: X402v2PaymentRequirementsScheme,
}Expand description
The x402 v2 payment requirements. Uses CAIP-2 network identifiers and supports exact, upto, and batch-settlement schemes. Carries only the payment fields (no resource metadata — that is in the enclosing x402V2PaymentPayload.resource).
JSON schema
{
"title": "x402V2PaymentRequirements",
"description": "The x402 v2 payment requirements. Uses CAIP-2 network identifiers and supports `exact`, `upto`, and `batch-settlement` schemes. Carries only the payment fields (no resource metadata — that is in the enclosing `x402V2PaymentPayload.resource`).",
"type": "object",
"required": [
"amount",
"asset",
"maxTimeoutSeconds",
"network",
"payTo",
"scheme"
],
"properties": {
"amount": {
"description": "The amount to pay for the resource in atomic units of the payment asset.",
"examples": [
"1000000"
],
"type": "string"
},
"asset": {
"description": "The asset to pay with.\n\nFor EVM networks, the asset will be a 0x-prefixed, checksum EVM address.\n\nFor Solana-based networks, the asset will be a base58-encoded Solana address.",
"examples": [
"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
],
"allOf": [
{
"$ref": "#/components/schemas/BlockchainAddress"
}
]
},
"extra": {
"description": "The optional additional scheme-specific payment info.",
"examples": [
{
"name": "USDC",
"version": "2"
}
],
"type": "object",
"additionalProperties": true
},
"maxTimeoutSeconds": {
"description": "The maximum time in seconds for the resource server to respond.",
"examples": [
10
],
"type": "integer"
},
"network": {
"description": "The network of the blockchain to send payment on in CAIP-2 format.",
"examples": [
"eip155:8453"
],
"allOf": [
{
"$ref": "#/components/schemas/X402V2Network"
}
]
},
"payTo": {
"description": "The destination to pay value to.\n\nFor EVM networks, payTo will be a 0x-prefixed, checksum EVM address.\n\nFor Solana-based networks, payTo will be a base58-encoded Solana address.",
"examples": [
"0x742d35Cc6634C0532925a3b844Bc454e4438f44e"
],
"allOf": [
{
"$ref": "#/components/schemas/BlockchainAddress"
}
]
},
"scheme": {
"description": "The scheme of the payment protocol to use. Supported schemes are `exact`, `upto`, and `batch-settlement`.",
"examples": [
"exact"
],
"type": "string",
"enum": [
"exact",
"upto",
"batch-settlement"
]
}
}
}Fields§
§amount: StringThe amount to pay for the resource in atomic units of the payment asset.
asset: BlockchainAddressThe asset to pay with.
For EVM networks, the asset will be a 0x-prefixed, checksum EVM address.
For Solana-based networks, the asset will be a base58-encoded Solana address.extra: Map<String, Value>The optional additional scheme-specific payment info.
max_timeout_seconds: i64The maximum time in seconds for the resource server to respond.
network: X402v2NetworkThe network of the blockchain to send payment on in CAIP-2 format.
pay_to: BlockchainAddressThe destination to pay value to.
For EVM networks, payTo will be a 0x-prefixed, checksum EVM address.
For Solana-based networks, payTo will be a base58-encoded Solana address.scheme: X402v2PaymentRequirementsSchemeThe scheme of the payment protocol to use. Supported schemes are exact, upto, and batch-settlement.
Implementations§
Source§impl X402V2PaymentRequirements
impl X402V2PaymentRequirements
pub fn builder() -> X402V2PaymentRequirements
Trait Implementations§
Source§impl Clone for X402V2PaymentRequirements
impl Clone for X402V2PaymentRequirements
Source§fn clone(&self) -> X402V2PaymentRequirements
fn clone(&self) -> X402V2PaymentRequirements
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for X402V2PaymentRequirements
impl Debug for X402V2PaymentRequirements
Source§impl<'de> Deserialize<'de> for X402V2PaymentRequirements
impl<'de> Deserialize<'de> for X402V2PaymentRequirements
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 From<&X402V2PaymentRequirements> for X402V2PaymentRequirements
impl From<&X402V2PaymentRequirements> for X402V2PaymentRequirements
Source§fn from(value: &X402V2PaymentRequirements) -> Self
fn from(value: &X402V2PaymentRequirements) -> Self
Converts to this type from the input type.
Source§impl From<X402V2PaymentRequirements> for X402PaymentRequirements
impl From<X402V2PaymentRequirements> for X402PaymentRequirements
Source§fn from(value: X402V2PaymentRequirements) -> Self
fn from(value: X402V2PaymentRequirements) -> Self
Converts to this type from the input type.
Source§impl From<X402V2PaymentRequirements> for X402V2PaymentRequirements
impl From<X402V2PaymentRequirements> for X402V2PaymentRequirements
Source§fn from(value: X402V2PaymentRequirements) -> Self
fn from(value: X402V2PaymentRequirements) -> Self
Converts to this type from the input type.
Source§impl TryFrom<X402V2PaymentRequirements> for X402V2PaymentRequirements
impl TryFrom<X402V2PaymentRequirements> for X402V2PaymentRequirements
Source§type Error = ConversionError
type Error = ConversionError
The type returned in the event of a conversion error.
Source§fn try_from(value: X402V2PaymentRequirements) -> Result<Self, ConversionError>
fn try_from(value: X402V2PaymentRequirements) -> Result<Self, ConversionError>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for X402V2PaymentRequirements
impl RefUnwindSafe for X402V2PaymentRequirements
impl Send for X402V2PaymentRequirements
impl Sync for X402V2PaymentRequirements
impl Unpin for X402V2PaymentRequirements
impl UnsafeUnpin for X402V2PaymentRequirements
impl UnwindSafe for X402V2PaymentRequirements
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
Mutably borrows from an owned value. Read more