#[non_exhaustive]pub struct PaymentPayload<TAccepted, TPayload> {
pub accepted: TAccepted,
pub payload: TPayload,
pub resource: Option<ResourceInfo>,
pub x402_version: Version2,
pub extensions: Extensions,
}Expand description
Signed payment authorization sent by the buyer.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.accepted: TAcceptedTerms the buyer accepted.
payload: TPayloadScheme-specific signed payload.
resource: Option<ResourceInfo>Optional resource metadata copied from the 402 response.
x402_version: Version2Protocol 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) -> Self
pub fn new(accepted: TAccepted, payload: TPayload) -> Self
Constructs a payload from the two required fields.
Sourcepub fn with_resource(self, resource: ResourceInfo) -> Self
pub fn with_resource(self, resource: ResourceInfo) -> Self
Attaches optional resource metadata.
Sourcepub fn with_optional_resource(self, resource: Option<ResourceInfo>) -> Self
pub fn with_optional_resource(self, resource: Option<ResourceInfo>) -> Self
Passes through an optional resource.
Sourcepub fn with_extensions(self, extensions: Extensions) -> Self
pub fn with_extensions(self, extensions: Extensions) -> Self
Replaces the extensions block.
Trait Implementations§
Source§impl<TAccepted: Clone, TPayload: Clone> Clone for PaymentPayload<TAccepted, TPayload>
impl<TAccepted: Clone, TPayload: Clone> Clone for PaymentPayload<TAccepted, TPayload>
Source§fn clone(&self) -> PaymentPayload<TAccepted, TPayload>
fn clone(&self) -> PaymentPayload<TAccepted, TPayload>
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<'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<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<TAccepted: PartialEq, TPayload: PartialEq> PartialEq for PaymentPayload<TAccepted, TPayload>
impl<TAccepted: PartialEq, TPayload: PartialEq> PartialEq for PaymentPayload<TAccepted, TPayload>
Source§impl<TAccepted, TPayload> Serialize for PaymentPayload<TAccepted, TPayload>
impl<TAccepted, TPayload> Serialize for PaymentPayload<TAccepted, TPayload>
impl<TAccepted: PartialEq, TPayload: PartialEq> StructuralPartialEq for PaymentPayload<TAccepted, TPayload>
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<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