Agent-to-agent micropayments
Hilt Pay API turns a paid agent request into durable operating state:- an x402 V2 payment requirement
- confirmed Solana USDC settlement
- a signed receipt
- an entitlement with metered units
- atomic usage records
- webhook and support context
/v1/access. x402 is the HTTP 402 Payment Required protocol shape. Solana USDC is the current public live settlement rail.
The runtime rule
For a metered endpoint, consume one unit before serving the result.- Identify the calling customer or agent.
- Call
POST /v1/access/entitlements/consume. - Serve the resource when consumption succeeds.
- When access is missing or exhausted, create an x402 payment session.
- Return
402with Hilt’sPAYMENT-REQUIREDheader. - Receive the buyer’s
PAYMENT-SIGNATUREheader. - Call
POST /v1/access/x402/settle. - Consume one unit and serve the resource.
Create a metered product
amount_minor_units uses USDC’s six decimal places. The example price is 5 USDC.
Create the challenge
PAYMENT-REQUIRED value exactly. Do not rebuild the acceptance in your application.
The product allows the Solana USDC settlement rail. The session selects payment_protocol: "x402" separately because x402 is the HTTP payment protocol, not a settlement rail.
Hilt exact payments
x402 allows payment schemes to define how value moves on each network. Hilt useshilt-exact when the payment includes a Hilt platform fee. The acceptance contains:
- the gross amount the buyer approves
- the merchant’s direct USDC transfer
- Hilt’s direct fee transfer
- a requirement that both transfers share one signed Solana transaction
exact scheme.
Sign and retry
Install the Hilt SDK plus the Solana libraries used by your wallet integration:PAYMENT-SIGNATURE and calls hilt.payApi.settleX402(...) with its server-side key.
The complete TypeScript example includes both boundaries and the Solana transaction builder.
Atomic usage consumption
What Hilt records
Each successful payment can create or update:- payment and settlement evidence
- signed receipt
- entitlement period
- granted and remaining usage
- idempotent usage events
- merchant webhook events
- support and audit context
Safety boundaries
- Never expose the Hilt API key to a browser or agent client.
- Never grant access from a raw transaction hash or unverified wallet claim.
- Never consume usage after serving the resource.
- Never treat x402 as a chain, token, wallet, or settlement rail.
- Use Hilt sandbox sessions to test payment, confirmation, and metered consumption without moving live funds.
- Use setup readiness before accepting live traffic.

