Skip to content

Function: reconcilePayment()

function reconcilePayment(payment, quoteAccepts): PaymentRequirements;

Defined in: rine-core/dist/src/x402/reconcile.d.ts:41

Return the payee-authored PaymentRequirements (from quoteAccepts) that the incoming payment legitimately answers, or throw. A quote entry matches iff ALL hold: same scheme; same network; same asset (case-insensitive); same payTo (case-insensitive); and the tier the payer's OWN accepted block NAMES (its exact atomic amount) equals the quote entry's atomic amount.

Matching on the EXACT named amount (not the first tier the amount happens to satisfy) is load-bearing: a multi-tier same-asset quote — accepts=[{1.0},{5.0}] on one asset/network/payTo — must return the tier the 5.0 payer selected, never the cheaper 1.0 entry a >= first-match would pick. Binding to the NAMED tier keeps the settled amount and matchedQuote aligned with the quote the payer answered.

Defense-in-depth: the SIGNED EIP-3009 authorization.value — not the payer- controlled echoed accepted.amount — must cover the quoted atomic amount, so a payment whose signed value underfunds the tier it names is refused LOCALLY even if a non-conformant facilitator would settle it. Overpayment (a signed value above the tier) is still allowed. Amounts compare in the token's own atomic units — asset+network already match, so no decimal scaling is needed and unknown-decimal assets don't spuriously block here.

The RETURNED value is the payee's own requirement; callers forward THAT to the facilitator, never payment.accepted.

Parameters

Parameter Type
payment PaymentPayload
quoteAccepts readonly PaymentRequirements[]

Returns

PaymentRequirements