Agents pay in HBAR. Nobody approves.

An agent discovers a service, clears its spend policy, answers a 402 challenge and settles in native HBAR. The worker writes an audit trail to consensus.

Track: Hedera Source verified Agent readable ↗
Before you start Node 22.13 or newer · pnpm 12.14.0 · Your configured deployment.
Native HBAR · asset 0.0.0. No Solidity is deployed on this track.

01 / Overview

An agent discovers a service, clears its spend policy, answers a 402 challenge and settles in native HBAR. The worker writes an audit trail to consensus.

This page follows the implementation in packages/sdk-server/src/x402.ts. The source explorer on the landing page exposes the workspace files used by the site.

02 / Quickstart

pnpm build
pnpm --filter pulsepay-demo-store start
pnpm --filter pulsepay-agent-worker start

Node 22.13 or newer · pnpm 12.14.0. Configure only the networks you will use. A funded account is needed only for wallet-authorized writes. No Solidity deployment is required.

03 / Walkthrough

Fetch /.well-known/x402.json from the API. POST /v1/services/market-data-pro/query without proof returns 402 with PAYMENT-REQUIRED. The challenge specifies native asset 0.0.0, amount, network, recipient and expiry. X402PayTool validates the terms, journals its transaction ID, pays once and retries the original request with PAYMENT-SIGNATURE.

The API checks the successful mirror receipt, payer debit, exact recipient and amount, challenge-bound memo and consensus time. Identical redeemed proof returns the saved response across restarts. A conflicting proof returns 409. This is PulsePay’s hedera-native-receipt extension; arbitrary facilitator interoperability is not implemented.

04 / Discovery and the challenge

EndpointMethodPurpose
/.well-known/x402.jsonGETActual service discovery manifest
/v1/services/market-data-pro/queryPOSTNative receipt protected resource
/api/hedera/paymentsGETMerchant-only verified payments
POST /v1/services/market-data-pro/query
← 402 PAYMENT-REQUIRED
  validate terms, reserve budget, sign and settle HBAR
POST /v1/services/market-data-pro/query (PAYMENT-SIGNATURE)
← 200 saved resource response

The service returns sample orderbook data. It is not a live market feed. Network and HCS fees are separate from the transfer budget.

05 / Anatomy

Class or fileResponsibility
generateX402ManifestPublishes native receipt discovery
handleX402PaymentCheckIssues challenges and independently verifies proof
X402PayToolJournals a transfer and redeems its receipt

Source: packages/sdk-server/src/x402.ts.

06 / Verification

Build the owning package before running the app. Confirm the requested network and address in /merchant/settings. Compare the UI against the contract read or mirror response, and use the public explorer transaction as independent evidence. A wallet signature or an unsigned transaction is not evidence of settlement.

pnpm build

For a failed read, use Retry and inspect the error attached to the real record. Test with reduced motion enabled and keyboard-only navigation. Do not submit paid network actions merely to verify rendering.

07 / Troubleshooting

SymptomCheckNext action
Configuration unavailableRoot .env and the configured deploymentSet the required public address, restart the web server, then retry.
Chain or service read failedRPC, mirror or paid API responseRetry the read; retain transaction evidence for an ambiguous write.
Wallet cannot executeAuthorized account, chain and balanceConnect the intended account and review the transaction in the wallet.
Data differs from an older screenshotCurrent source and onchain stateUse the real record. Historical and preview values are not accounting evidence.
Was this page useful? Needs work ↗