Skip to main content
With x402, the caller pays for each round as it asks for it: one standard x402 v2 exact USDC payment on Solana authorizes exactly one round. There is no subscription, no escrow account and no request signature beyond the payment itself. It suits AI agents and one-off consumers. The easiest way to use it is through MCP: hosted or local. This page describes the protocol underneath.

Flow

  1. Send POST /v1/x402/execute with signatures_required, registry_version and source, without a payment header.
  2. The gateway answers 402 Payment Required with a base64 PAYMENT-REQUIRED header and the same object in the body. Its accepts entry gives the scheme exact, the Solana network, the amount, the USDC mint, payTo, extra.feePayer and extra.memo.
  3. Sign a payment that matches that entry exactly and retry the same body with PAYMENT-SIGNATURE: <base64 payment payload>.
  4. The gateway verifies the payment through its facilitator before dispatching the round, then settles it and returns the attestation with a PAYMENT-RESPONSE receipt.
Request and response schemas are in the HTTP API reference.

Price and payee

The amount is in USDC base units (6 decimals). x402_round_base and reward_per_signature come from the on-chain ProtocolConfig, and redundancy_buffer from the current registry, so the whole selected group is paid for. GET /v1/x402/status returns a quote. On devnet x402_round_base is 0.05 USDC, reward_per_signature 0.01 USDC and the redundancy buffer 2: payTo is the protocol treasury: the ProtocolConfig PDA, whose USDC token account receives the payment. It is never the gateway, and the gateway takes no fee. Treasury income is later swept into the epoch reward pool for nodes. Always sign what the 402 advertises rather than these constants: the amount, payee and memo come from chain state at the time of the request.

Payment memo

extra.memo is the hex of:
It binds the payment to the program, the gateway, the source, the quorum and the registry version. It does not name a round, because the gateway assigns the round’s timestamp only after it has verified the payment. A payment therefore fits any round of that feed, and the gateway stops reuse by recording each payment once it has been used. Sign exactly the memo and fee payer the gateway advertised.

Retries and failures

  • One payment, one round. A payment is recorded once used; sending it again is 409.
  • No idempotency key. A retried request is a new round and needs a new payment once the first one has been used.
  • Shared rounds are paid per caller. Requests for one feed inside one 100 ms tick share one round; each payer still pays for its own request.
  • 409 costs nothing. You already have a round for this source and quorum in the current 100 ms tick, or this payment already reserved a round. Nothing is reserved and an unused payment stays usable. Retry after one tick. See round timing.
  • 503 at capacity costs nothing. When the gateway is at capacity it refuses with Retry-After before reading the request.
  • A failed round is voided, not refunded. Once the round has been sent to the nodes, a failure voids it: the gateway never settles the payment, so no USDC moves and there is nothing to refund, but it will not accept that payment again. Sign a new payment to retry.
  • An unclear outcome is not a reason to pay again. After an ambiguous 5xx or a dropped connection, check your USDC account for the payment’s memo before paying for the round again.

Paywalled API sources

An API source can itself charge over x402. In that case the caller pays the source directly: request a quote with x402Source, then send one caller-signed authorization per eligible node in sourcePayments. Those payments go to the source, never to Molpha, and the round payment above is unchanged. Sources of an integrated provider are quoted the same way. Details are in the HTTP API reference.

Trust

The gateway verifies and settles payments through a trusted x402 facilitator and never accepts a caller-supplied payer ID as evidence. A 200 response proves neither on-chain settlement nor a valid signature: verify the attestation before you use it. To compare x402 with subscriptions and delegates, see Access and payments.