Confidential by defaultEstablished 201072 Jurisdictions

x402 Security, Fraud, Treasury, and Agent Spending Controls

x402 Security, Fraud, Treasury, and Operational Controls

Payment software should assume that inputs are hostile.

Risk 1 — Private-key compromise

Impact:

attacker spends agent funds

Controls:

  • never hard-code production keys;

  • segregate wallets;

  • cap balances;

  • KMS/HSM/managed signing;

  • key rotation;

  • emergency disable.


Risk 2 — Agent overspending

Impact:

correct protocol
wrong economic decision

Controls:

per-call limit
per-vendor limit
hourly limit
daily limit
asset allowlist
network allowlist
tool allowlist
human-approval thresholds

This is likely to become a major agent-payment product category.


Risk 3 — Prompt injection causes purchase

An AI agent could be manipulated by content into making an unwanted purchase.

Payment authorization must therefore be separated from arbitrary model instructions.

Do not let:

"The webpage told the AI to pay $500"

become sufficient authorization.

Use deterministic policy outside the model.


Risk 4 — Replay / duplicate execution

Controls:

  • nonce rules;

  • idempotency;

  • settlement cache where required;

  • resource execution identifiers;

  • payment identifiers;

  • duplicate detection.


Risk 5 — Payment-route bypass

A malformed URL or routing edge case could potentially reach a paid handler without payment middleware if routing is implemented incorrectly.

Controls:

  • route tests;

  • canonical path handling;

  • regression tests;

  • default-deny protected namespaces;

  • security review.

The rapid SDK changelog is a reminder that route and settlement edge cases are real engineering concerns.


Risk 6 — Settlement ambiguity

A transaction may be broadcast but confirmation may time out.

Do not interpret:

timeout

as automatically equivalent to:

payment definitely failed

The current SDK explicitly recognizes settlement_pending scenarios for this reason.

You need reconciliation.


Risk 7 — Facilitator outage

Have a policy:

fail closed?
switch facilitator?
queue?
show temporary error?

For valuable resources, avoid delivering merely because the payment infrastructure is unavailable.


Risk 8 — Asset volatility

Stablecoins reduce but do not eliminate risk.

If accepting non-pegged tokens, decide:

  • quote source;

  • quote expiry;

  • slippage;

  • accounting currency;

  • treasury conversion.


Risk 9 — Stablecoin issuer/contract risk

“US$1 stablecoin” is not identical to “US$1 bank deposit.”

Treasury must understand:

  • issuer exposure;

  • chain representation;

  • bridge risk;

  • freeze functionality;

  • redemption path;

  • liquidity.


Risk 10 — Refunds

Plain on-chain payments may not have card-style reversibility.

You need your own refund policy and mechanism.

For example:

customer support authorizes refund
        ↓
treasury sends new payment back
        ↓
link refund to original payment identifier

Do not confuse:

irreversible settlement

with:

merchant has no refund obligation.

If You Are Building This Commercially

If customer fiat is held or administered as part of the wider product, payment security must also extend to account ownership and segregation. Depending on the model, review whether an FBO account or other customer-money structure is appropriate.

Key Takeaway

The model may propose a purchase, but deterministic policy should decide whether it is permitted and a restricted signer should enforce that decision.

This page is part of x402 Protocol Explained, the full guide to how machine-to-machine payments work.

Sources and Further Reading

Share
Page Last Updated: 21/Sep/2026 (6063822)