402 Hedera Pay

HTTP 402 for HBAR and HTS

Hedera Pay 402

A pay.sh-style gateway for agents and APIs: request, quote, pay on Hedera, verify through Mirror Node, then unlock the response.

GET /v1/quote
402 PAYMENT REQUIRED
PAYMENT-REQUIRED: h402_invoice
PAYMENT-SIGNATURE: tx:0.0.999...
200 OK + PAYMENT-RESPONSE

Research result

Hedera has the pieces. The product is the gateway.

01

Challenge

The API returns `PAYMENT-REQUIRED` with network, asset, amount, receiver, memo, expiry, and resource scope.

02

Pay

WalletConnect or a capped CLI wallet submits a Hedera transfer transaction using HBAR or an HTS fungible token.

03

Verify

The gateway checks Mirror Node records for `SUCCESS`, memo, recipient, amount, token id, timestamp, and payer debit.

04

Serve

Replay-safe proof unlocks the protected response. A receipt header closes the loop for agents and logs.

Built MVP

Verifier-first, no custody.

The shipped core validates invoices against mocked Mirror Node transaction records. It rejects expired invoices, wrong memos, underpayments, payer mismatches, and replayed transaction ids.

verifyPayment({
  challenge,
  payment,
  mirrorNode,
  replayStore
})

// confirms:
// SUCCESS tx
// memo == invoice
// payTo received amount
// token id matches
// proof not replayed
HBAR tinybars / HTS USDC / Mirror Node / HIP-820 / WalletConnect / x402-shaped headers / replay guard /

Ship path

From proof to facilitator.

NowStatic landing page, spec, tested challenge model, tested verifier.
NextHTTP middleware, `/verify`, `/settle`, Redis replay storage, wallet adapters.
ProductionProvider dashboard, route pricing, private mirror provider, spending caps for agents.