pub struct ReceiptPayload<'a> {Show 13 fields
pub kind: &'a str,
pub reference: &'a str,
pub amount: &'a str,
pub currency: &'a str,
pub recipient: &'a str,
pub method: &'a str,
pub timestamp: &'a str,
pub tool_call_id: &'a str,
pub approval_pos: &'a str,
pub approved_args_hash: &'a str,
pub subject: &'a str,
pub payer_kind: &'a str,
pub paying_account: &'a str,
}Expand description
The receipt body fields receipt_payload signs, named at the call site.
Replaces positional &str arguments: with the positional form, two
same-typed fields (e.g. recipient and method) could be swapped at a call
site and still compile, silently signing a corrupt receipt. Naming the
fields here makes such a swap a compile error.
The field set, names, and the order they are serialized in
receipt_payload are the signed-payload contract: they must NOT change
without a version bump, or previously-persisted receipts stop verifying.
kind and the trailing four fields are v2 additions: the event kind
(direction) plus the binding tuple and an opaque subject. Inbound (the
server was paid) receipts have no approved tool call, so they pass empty
strings for the binding tuple and subject; outbound (the control plane
paid a 402 service) receipts populate them. Both directions sign their
kind.
Fields§
§kind: &'a strThe event kind the payload is stored under (payment_receipt for
inbound, outbound_payment_receipt for outbound). Signed so a payload
cannot be re-filed under the other direction’s kind (v2; empty for
legacy v1).
reference: &'a strChain/transaction reference (e.g. tx id) the receipt settles.
amount: &'a strSettled amount as a string, never a float (no drift, no rounding).
The UNIT is the direction’s, not this type’s, and the two directions do
not agree: an inbound receipt (payment_receipt) carries a decimal
figure in the settlement currency ("0.01"), an outbound one
(outbound_payment_receipt) carries the settlement token’s base units
("10000", or "" when the payment proxy could not capture the
charge). Read it through the matching polyc_payments::amount reader,
dispatched on Self::kind — never with a bare parse, and never by
guessing from the string’s shape.
currency: &'a strCurrency / asset label. Follows the same per-direction split as
Self::amount: the settlement currency symbol inbound, the
settlement token’s contract address outbound.
recipient: &'a strRecipient address.
method: &'a strSettlement method (e.g. tempo).
timestamp: &'a strRFC3339 settlement timestamp.
tool_call_id: &'a strThe paid_fetch tool-call id this payment answered (v2; empty for
inbound and legacy v1).
approval_pos: &'a strDecimal string of the approval_request log position the payment
answered (v2; empty for inbound and legacy v1).
approved_args_hash: &'a strsha256 hex of the approved args_json — the same idempotency-key
component the outbound_payment_attempt marker carries, so a verifier
can cross-check the receipt against the attempt (v2; empty otherwise).
subject: &'a strOpaque principal the spend is attributed to. Currently the conversation id; the structured agent/tenant identity is supplied later by the declarative-catalog identity model. Treat as opaque (v2; empty otherwise).
payer_kind: &'a strWhich account actually paid: "linked_wallet" or "deployment" — the
stable vocabulary PayerKind::as_str mints (in the payments client
resolver). Explicit unknown (empty string) for v1/v2 receipts and for
inbound receipts, which have no payer concept — never inferred (v3).
paying_account: &'a strThe paying account’s own address, when known. Empty when the payer is the deployment’s own signer (there is no separate “paying account” to name beyond the signer itself) or when this build cannot observe it (v3; empty for v1/v2 and inbound receipts).
Trait Implementations§
Source§impl<'a> Clone for ReceiptPayload<'a>
impl<'a> Clone for ReceiptPayload<'a>
Source§fn clone(&self) -> ReceiptPayload<'a>
fn clone(&self) -> ReceiptPayload<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<'a> Copy for ReceiptPayload<'a>
Auto Trait Implementations§
impl<'a> Freeze for ReceiptPayload<'a>
impl<'a> RefUnwindSafe for ReceiptPayload<'a>
impl<'a> Send for ReceiptPayload<'a>
impl<'a> Sync for ReceiptPayload<'a>
impl<'a> Unpin for ReceiptPayload<'a>
impl<'a> UnsafeUnpin for ReceiptPayload<'a>
impl<'a> UnwindSafe for ReceiptPayload<'a>
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
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,
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