HBAR/USD rate
Paid, per query. Returns the HBAR/USD rate the Hedera network itself uses for fees, read from the exchange rate file through the mirror node, with the consensus expiry of that rate. Priced per unit with unit “query”, so the 402 always asks for exactly one unit; pass quoteId as a query parameter to pin a quote. A mirror node failure answers 502 and cancels settlement.
BuyerAgent.hbarRate() handle it.Headers
x402 payment payload (base64 JSON) built from the PAYMENT-REQUIRED challenge of the 402 answer. Omit on the first call to receive the price. BuyerAgent and @x402/fetch set this for you. The legacy name X-PAYMENT is also accepted.
Query Parameters
Quote to pin the price to, from requestQuote with endpointId hbar-rate.
Response
Current rate
HBAR/USD centsPerHbar / 100
cent_equivalent / hbar_equivalent from the network exchange rate file
Unix seconds at which the network rate expires