pub struct PaymentAuthorization {
pub payment_id: String,
pub actual_amount: String,
pub payment_address: String,
pub asset_address: String,
pub network: String,
pub timestamp: DateTime<Utc>,
pub signature: String,
pub public_key: String,
pub transaction_hash: Option<String>,
}Expand description
Payment authorization sent with retry request
Fields§
§payment_id: StringPayment ID from the original request
actual_amount: StringActual amount paid in USDC (e.g., “0.10”)
payment_address: StringRecipient wallet address
asset_address: StringToken mint address
network: StringNetwork identifier
timestamp: DateTime<Utc>Timestamp when payment was authorized
signature: StringSolana transaction signature
public_key: StringPayer’s public key
transaction_hash: Option<String>On-chain transaction hash (optional, may be same as signature)
Implementations§
Source§impl PaymentAuthorization
impl PaymentAuthorization
Sourcepub fn new(
payment_id: String,
actual_amount: String,
payment_address: String,
asset_address: String,
network: String,
signature: String,
public_key: String,
) -> PaymentAuthorization
pub fn new( payment_id: String, actual_amount: String, payment_address: String, asset_address: String, network: String, signature: String, public_key: String, ) -> PaymentAuthorization
Create a new payment authorization
Sourcepub fn from_json(json: &str) -> Result<PaymentAuthorization, X402Error>
pub fn from_json(json: &str) -> Result<PaymentAuthorization, X402Error>
Parse payment authorization from JSON string
Sourcepub fn to_json(&self) -> Result<String, X402Error>
pub fn to_json(&self) -> Result<String, X402Error>
Convert payment authorization to JSON string
Sourcepub fn to_header_value(&self) -> Result<String, X402Error>
pub fn to_header_value(&self) -> Result<String, X402Error>
Encode payment authorization as base64 JSON for X-Payment-Authorization header
Sourcepub fn from_header_value(
encoded: &str,
) -> Result<PaymentAuthorization, X402Error>
pub fn from_header_value( encoded: &str, ) -> Result<PaymentAuthorization, X402Error>
Decode payment authorization from X-Payment-Authorization header value
Trait Implementations§
Source§impl Clone for PaymentAuthorization
impl Clone for PaymentAuthorization
Source§fn clone(&self) -> PaymentAuthorization
fn clone(&self) -> PaymentAuthorization
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 PaymentAuthorization
impl Debug for PaymentAuthorization
Source§impl<'de> Deserialize<'de> for PaymentAuthorization
impl<'de> Deserialize<'de> for PaymentAuthorization
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PaymentAuthorization, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PaymentAuthorization, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PaymentAuthorization
impl PartialEq for PaymentAuthorization
Source§impl Serialize for PaymentAuthorization
impl Serialize for PaymentAuthorization
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,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for PaymentAuthorization
Auto Trait Implementations§
impl Freeze for PaymentAuthorization
impl RefUnwindSafe for PaymentAuthorization
impl Send for PaymentAuthorization
impl Sync for PaymentAuthorization
impl Unpin for PaymentAuthorization
impl UnsafeUnpin for PaymentAuthorization
impl UnwindSafe for PaymentAuthorization
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
Mutably borrows from an owned value. Read more
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> 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> ⓘ
Converts
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> ⓘ
Converts
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