#[non_exhaustive]pub struct PaymentPayload<TAccepted, TPayload> {
pub accepted: TAccepted,
pub payload: TPayload,
pub resource: Option<ResourceInfo>,
pub x402_version: Version<2>,
pub extensions: Extensions,
}Expand description
A signed payment authorization sent by the buyer to the seller.
In x402 v2 the payload is self-describing: it carries the accepted
requirements the buyer chose (so the facilitator can re-verify them)
plus the scheme-specific payload, an optional resource descriptor,
and an optional extensions map.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.accepted: TAcceptedThe terms the buyer accepted (a full super::PaymentRequirements form).
payload: TPayloadScheme-specific signed payload (e.g., EIP-3009 authorization).
resource: Option<ResourceInfo>Optional resource metadata copied from the 402 response.
x402_version: Version<2>Protocol version marker (always 2).
extensions: ExtensionsOptional extension payload block.
Implementations§
Source§impl<TAccepted, TPayload> PaymentPayload<TAccepted, TPayload>
impl<TAccepted, TPayload> PaymentPayload<TAccepted, TPayload>
Sourcepub fn new(
accepted: TAccepted,
payload: TPayload,
) -> PaymentPayload<TAccepted, TPayload>
pub fn new( accepted: TAccepted, payload: TPayload, ) -> PaymentPayload<TAccepted, TPayload>
Constructs a payload from the two required fields. Use the
Self::with_resource / Self::with_extensions builders to
attach the optional blocks.
Sourcepub fn with_resource(
self,
resource: ResourceInfo,
) -> PaymentPayload<TAccepted, TPayload>
pub fn with_resource( self, resource: ResourceInfo, ) -> PaymentPayload<TAccepted, TPayload>
Builder: attaches optional resource metadata.
Sourcepub fn with_optional_resource(
self,
resource: Option<ResourceInfo>,
) -> PaymentPayload<TAccepted, TPayload>
pub fn with_optional_resource( self, resource: Option<ResourceInfo>, ) -> PaymentPayload<TAccepted, TPayload>
Builder: attaches an optional resource (passes through None
untouched, useful when the value is produced via Option::map).
Sourcepub fn with_extensions(
self,
extensions: Extensions,
) -> PaymentPayload<TAccepted, TPayload>
pub fn with_extensions( self, extensions: Extensions, ) -> PaymentPayload<TAccepted, TPayload>
Builder: replaces the extensions block.
Trait Implementations§
Source§impl<TAccepted, TPayload> Clone for PaymentPayload<TAccepted, TPayload>
impl<TAccepted, TPayload> Clone for PaymentPayload<TAccepted, TPayload>
Source§fn clone(&self) -> PaymentPayload<TAccepted, TPayload>
fn clone(&self) -> PaymentPayload<TAccepted, TPayload>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<TAccepted, TPayload> Debug for PaymentPayload<TAccepted, TPayload>
impl<TAccepted, TPayload> Debug for PaymentPayload<TAccepted, TPayload>
Source§impl<'de, TAccepted, TPayload> Deserialize<'de> for PaymentPayload<TAccepted, TPayload>where
TAccepted: Deserialize<'de>,
TPayload: Deserialize<'de>,
impl<'de, TAccepted, TPayload> Deserialize<'de> for PaymentPayload<TAccepted, TPayload>where
TAccepted: Deserialize<'de>,
TPayload: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PaymentPayload<TAccepted, TPayload>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PaymentPayload<TAccepted, TPayload>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<TAccepted, TPayload> Serialize for PaymentPayload<TAccepted, TPayload>
impl<TAccepted, TPayload> Serialize for PaymentPayload<TAccepted, TPayload>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl<TAccepted, TPayload> Freeze for PaymentPayload<TAccepted, TPayload>
impl<TAccepted, TPayload> RefUnwindSafe for PaymentPayload<TAccepted, TPayload>where
TAccepted: RefUnwindSafe,
TPayload: RefUnwindSafe,
impl<TAccepted, TPayload> Send for PaymentPayload<TAccepted, TPayload>
impl<TAccepted, TPayload> Sync for PaymentPayload<TAccepted, TPayload>
impl<TAccepted, TPayload> Unpin for PaymentPayload<TAccepted, TPayload>
impl<TAccepted, TPayload> UnsafeUnpin for PaymentPayload<TAccepted, TPayload>where
TAccepted: UnsafeUnpin,
TPayload: UnsafeUnpin,
impl<TAccepted, TPayload> UnwindSafe for PaymentPayload<TAccepted, TPayload>where
TAccepted: UnwindSafe,
TPayload: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<'de, T> BorrowedRpcObject<'de> for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more