UCP payment handler specification
Schema: /schemas/payment-handlers/x402.json
x402, multi-chain. Today AgentScore merchants ship the EVM scheme (Base); x402 also publishes Solana and Stellar schemes which slot in as additional `networks` entries.
AgentScore binding for x402 in UCP. x402 is a multi-chain payment protocol: today AgentScore merchants ship `@x402/evm` (Base via signed EIP-3009 transferWithAuthorization). x402 itself also publishes `@x402/svm` (Solana) and `@x402/stellar`; an AgentScore merchant adopts those by adding the relevant network identifier to `networks`. A facilitator (merchant-side or hosted, e.g. Coinbase CDP for EVM) verifies and settles on-chain. The x402 protocol itself is specified at x402.org.
The schema for the binding's `config` object lives at /schemas/payment-handlers/x402.json. The wrapper fields (id, version, spec, schema, config) are defined by UCP itself.
Fields:
networks (array of object): Array of x402 networks the merchant accepts. One entry per network. Must contain at least one entry.networks[].network (string): Network identifier matching x402's convention. EVM uses `<chain>-<chain_id>` (e.g. `base-8453`, `base-84532`); Solana uses `solana-mainnet-beta` / `solana-devnet`; Stellar uses `stellar-pubnet` / `stellar-testnet`.networks[].recipient (string (optional)): Optional. Merchant's static settlement address on this network. When present, agents MAY cross-check the 402 challenge's `payTo` against this declared address as MITM protection. Omit if the merchant uses per-order recipients on this network; the authoritative recipient still ships in the 402 body. Symmetric with mpp's `chains[].recipient`.Example config:
{
"networks": [
{ "network": "base-8453", "recipient": "0xabc..." }
]
}End-to-end flow from the merchant's 402 challenge to settlement:
accepts[] including an x402 entry per accepted network: { scheme: "exact", network: "base-8453", maxAmountRequired, asset, payTo, extra: { name } }. For EVM, extra.name MUST come from the on-chain USDC contract's name() (per the registered scheme).from = agent's wallet, to = merchant's payTo, value = maxAmountRequired); Solana uses an SPL TransferChecked instruction; Stellar uses a SEP-10 / Soroban payment.X-Payment-Response header carrying the base64 settle receipt.Merchant-side responsibilities once the agent's payment credential arrives on the retry leg:
X-Payment header (or Authorization: Payment ) from the agent's retry.verifyX402Request({acceptedNetwork}) for EVM): parse the payload, confirm the network + payTo + value match the 402 challenge.settle_payment for EVM) which co-signs and submits the transaction on-chain.X-Payment-Response header carrying the base64 settle receipt.transferWithAuthorization (EVM) is replay-resistant via a nonce; the merchant MUST track used nonces (or rely on the facilitator to do so) to prevent double-spend. Equivalent replay protection exists per chain on Solana and Stellar.extra.name in the EVM 402 challenge MUST match the on-chain USDC contract's name() exactly; clients reject signatures that don't. Hardcoding will break across networks (Base mainnet USD Coin vs other chains).agentscore-pay (npm: @agent-score/pay). See docs.agentscore.com/integrations/pay-cli