diff --git a/src/pages/agents/cli/commands.mdx b/src/pages/agents/cli/commands.mdx index 1d2718c..8fd6dca 100644 --- a/src/pages/agents/cli/commands.mdx +++ b/src/pages/agents/cli/commands.mdx @@ -116,6 +116,10 @@ parallel pay prepare --amount --recipient
[--chain ] [--wal `pay prepare` builds an x402 payment payload: `--token` sets what the merchant receives (`usdp` by default, `usdc`, `susdp`, a collateral symbol or a token address), `--pay-with` forces the paying token (`usdp`, `usdc` or `susdp`). With `--wallet` it auto-selects the route from your balances and signs the payload. This is the engine behind [agent payments](/agents/x402/agent-quickstart) — agents rarely call it directly. +`--scheme upto` signs `--amount` as a cap for a [metered payment](/agents/x402/concepts#exact-and-metered-payments), in USDp only, and `--valid-for ` sets the window the merchant announced, 3,600 at most. The default scheme is `exact`. + +Since 0.4.1, `pay prepare` reads the signing domain from the token's `DOMAIN_SEPARATOR()` instead of calling `version()`, which USDp and sUSDp do not have: on Base, a USDp or sUSDp payment is prepared in about half a second instead of about 5. A token whose domain matches no known version is refused with `ROUTE_UNAVAILABLE` before anything is signed. + `pay verify` reports `confirmed: true` only for payments the facilitator actually settled — a merely mined transaction returns `confirmed: false` with `txMined: true`, and an unknown hash returns everything `false`. ## Utilities @@ -143,7 +147,7 @@ Failures exit 1 and print `Error [CODE]: message`. In JSON mode the envelope `{ | `COLLATERAL_NOT_SUPPORTED` | Collateral (or bridge token) not accepted on this chain | | `EXCEEDS_CAP` | Mint or redeem beyond the collateral's deposited capacity — the message carries the remaining capacity | | `EXCEEDS_BRIDGE_LIMIT` | Daily or global bridge limit reached — the message carries the reset time | -| `ROUTE_UNAVAILABLE` | The bridge route does not exist (same chain, or no bridgeable token on the destination) | +| `ROUTE_UNAVAILABLE` | The bridge route does not exist (same chain, or no bridgeable token on the destination), or `pay prepare` cannot sign for the token: its signing domain matches no known version | | `PARTIAL_READ` | Some chain reads failed and the aggregate would be wrong — retry shortly | | `INSUFFICIENT_BALANCE` | Wallet balance too low for the requested amount | | `WALLET_REQUIRED` | Signing requested but no wallet available | diff --git a/src/pages/agents/cli/index.mdx b/src/pages/agents/cli/index.mdx index 5f41259..b93ee62 100644 --- a/src/pages/agents/cli/index.mdx +++ b/src/pages/agents/cli/index.mdx @@ -20,7 +20,7 @@ npm install -g @parallel-protocol/cli npx @parallel-protocol/cli protocol overview ``` -Requires Node.js ≥ 22. +Requires Node.js ≥ 22. The package is MIT-licensed. ## 2. Read the protocol — no wallet, no config diff --git a/src/pages/agents/faq.mdx b/src/pages/agents/faq.mdx index 0e713e2..5cf3843 100644 --- a/src/pages/agents/faq.mdx +++ b/src/pages/agents/faq.mdx @@ -35,7 +35,7 @@ import { HelpFooter } from '@/components/HelpFooter' }, { question: "What happens if the facilitator goes down?", - answer: "Payments fail safe: if the facilitator is unreachable, nothing settles — signed authorizations simply expire and no funds move. A public status page for the hosted instance is being set up." + answer: "Payments fail safe: if the facilitator is unreachable, nothing settles — signed authorizations simply expire and no funds move. If only a settle's answer is lost, the SDK retries the settle once, which is safe since the facilitator answers a repeated settle with its recorded outcome; if that fails too, the agent gets a 402 saying the payment may still settle, and should check with the merchant before paying again. A public status page for the hosted instance is being set up." }, { question: "How do I get notified when an agent pays?", diff --git a/src/pages/agents/recipes/migrate-from-coinbase-x402.mdx b/src/pages/agents/recipes/migrate-from-coinbase-x402.mdx index 5547bd2..f399fc0 100644 --- a/src/pages/agents/recipes/migrate-from-coinbase-x402.mdx +++ b/src/pages/agents/recipes/migrate-from-coinbase-x402.mdx @@ -40,6 +40,10 @@ app.use(paymentMiddleware({ })); ``` +Install `@parallel-protocol/x402` 0.8.1 or later: since 1 October 2026 the facilitator refuses a settle that does not present the token it issued at verify, and versions before 0.8.0 do not send it. Version 0.8.1 adds the URL checks below. + +Keep the facilitator's URL in https, as above. Since 0.8.1, the SDK refuses a plain http URL outside `localhost`, `127.0.0.1` and `[::1]` with an `X402ConfigError` when the middleware is created. It calls that address only and never follows a redirect, which fails the call with `FACILITATOR_UNAVAILABLE`. + The shape changes — `payTo` moves into the route, and prices drop the `$` prefix — but every concept maps one-to-one. Agents paying in USDC keep paying in USDC. Agents holding USDp can now pay you natively, with the facilitator handling conversion at no extra fee. ## What you gain diff --git a/src/pages/agents/x402/agent-quickstart.mdx b/src/pages/agents/x402/agent-quickstart.mdx index e8031c7..bf08abf 100644 --- a/src/pages/agents/x402/agent-quickstart.mdx +++ b/src/pages/agents/x402/agent-quickstart.mdx @@ -15,6 +15,10 @@ This guide makes an agent pay x402 APIs autonomously. The whole integration is o npm install @parallel-protocol/x402-fetch ``` +This page describes version 0.3.0, the one a fresh install gets. The package signs through the payment engine of the [Parallel CLI](/agents/cli), `@parallel-protocol/cli`, which it installs as a regular dependency. Since version 0.2.3 it accepts the CLI's 0.4 line, so a fresh install gets CLI 0.4.1, which prepares a USDp or sUSDp payment on Base in about half a second instead of about 5 seconds; an existing project gets it by refreshing its lockfile. With CLI 0.4.1 and the facilitator update shipped alongside it, Parallel measured a paid call on Base at 3.5 seconds end to end, down from 9.4. + +A project on 0.2 moves to 0.3.0 by installing it, since a `^0.2` range does not reach 0.3. Code that read the response of a paid request answered with `402` must then catch an error instead: from 0.3.0, `payFetch` rejects with an `X402FetchError`, as described in [When the merchant refuses the payment](#when-the-merchant-refuses-the-payment) and [When the settlement fails](#when-the-settlement-fails). + ## 2. Fund a wallet The agent needs a wallet holding a small amount of **USDp, USDC, or sUSDp** on the target chain. **No ETH required** — settlement is relayed and gas is sponsored. Use a dedicated wallet holding only what you intend to spend. @@ -34,18 +38,25 @@ const payFetch = wrapFetchWithPayment(fetch, { maxAmount: "1", // hard spend cap per request }); +let res: Response; try { - const res = await payFetch("https://api.parallel.best/public/x402/base/snapshot"); - const data = await res.json(); - - const receipt = decodePaymentResponse(res); - console.log("paid:", receipt?.txHash, "gas sponsored:", receipt?.gasSponsored); + res = await payFetch("https://api.parallel.best/public/x402/base/snapshot"); } catch (err) { if (err instanceof X402FetchError) { - // A guard refused the invoice BEFORE signing — nothing was spent. - console.error(`refused [${err.code}]: ${err.message}`); + // PAYMENT_REFUSED and SETTLEMENT_FAILED: the merchant answered the paid + // request with 402, see err.reason and err.retryAfter. Every other code + // is raised before any payment is sent. + console.error(`payment failed [${err.code}]: ${err.message}`); } + throw err; } + +const data = await res.json(); + +// Any payment was sent by now: if the receipt header cannot be decoded, this +// throws INVALID_INVOICE, which is no reason to pay again. +const receipt = decodePaymentResponse(res); +console.log("paid:", receipt?.txHash, "gas sponsored:", receipt?.gasSponsored); ``` That's the entire agent. The first request costs nothing (it just reads the `402` invoice); the paid retry carries the signed authorization. @@ -57,9 +68,12 @@ The URL in the example is real: it is Parallel's **live demo API**, where every | Option | Default | Purpose | |---|---|---| | `privateKey` | — | The agent's signing key. Pass it explicitly (recommended, any env var name you like) — or omit it and the package falls back to the `PARALLEL_PRIVATE_KEY` environment variable. It never leaves the machine; only signatures go over the network. | -| `chain` | — | Chain to pay on: `"base"`, `"avalanche"`, `"hyperevm"`, or `"ethereum"`. Invoices for any other chain are refused. | +| `chain` | `"base"` | Chain to pay on: `"base"`, `"avalanche"`, `"hyperevm"`, or `"ethereum"`. Invoices for any other chain are refused. | | `payWith` | *(auto)* | Force a payment token (`"usdp"`, `"usdc"`, `"susdp"`). Omitted, the agent picks from its balances. | | `maxAmount` | `"1"` | Hard spend cap per request, in token units. Invoices above it are refused before signing. | +| `dailyBudget` | *(none)* | Cumulative spend ceiling per UTC day, across every payment the wrapper signs. Without it, nothing limits how many capped payments a day can sign. | +| `timeoutMs` | `60000` | Time budget of the payment engine, in milliseconds. | +| `allowInsecure` | `false` | Pay merchants served over plain `http://`. Localhost is always allowed. | ## Refusals cost nothing @@ -67,19 +81,72 @@ Every guard fires **before** the agent signs — a refused invoice never spends | Code | Cause | |---|---| -| `NO_SIGNING_KEY` | No private key provided (option or env). | +| `NO_SIGNING_KEY` | No private key provided (option or env), or a malformed one. Thrown when you wrap `fetch`. | +| `UNKNOWN_CHAIN` | The configured `chain` is not a known chain. Thrown when you wrap `fetch`. | | `AMOUNT_EXCEEDS_MAX` | The invoice asks more than `maxAmount`. | +| `BUDGET_EXCEEDED` | The invoice would take the day's spend past `dailyBudget`. | | `CHAIN_MISMATCH` | The invoice targets a different chain than configured. | -| `INVALID_INVOICE` | The `402` response is malformed. | +| `UNSUPPORTED_SCHEME` | The invoice offers only schemes this client cannot pay on the configured chain. It pays `exact` invoices, and `upto` invoices in USDp. | +| `INVALID_INVOICE` | An invoice field is malformed: a `payTo` or `asset` that is not an address, an amount that is not a positive integer, or decimals that contradict the token catalog or fall outside 0 to 36. `decodePaymentResponse` also throws it, after the payment, when the receipt header cannot be decoded. | | `INSECURE_URL` | The merchant URL is plain `http://` (localhost excepted). | -| `ENGINE_FAILED` | Payment preparation failed — the message carries the cause (usually balance, or a transient RPC error). | +| `ENGINE_NOT_FOUND` | The payment engine, `@parallel-protocol/cli`, could not be found. | +| `ENGINE_FAILED` | Payment preparation failed — the message carries the cause (usually balance, or a transient RPC error), and `engineCode` the engine's code, such as `INSUFFICIENT_BALANCE`. | | `ENGINE_TIMEOUT` | Payment preparation exceeded its time budget. | +Two more codes from `payFetch` come after the payment is sent, when the merchant answers the paid request with `402`: `PAYMENT_REFUSED` and `SETTLEMENT_FAILED`. The sections below describe them. + +## Metered invoices + +A merchant can invoice a route with the `upto` scheme: a cap rather than a price, for a resource whose cost is only known once it is served. The agent signs the cap for the window the merchant announced (`maxTimeoutSeconds`, 3,600 seconds at most), the merchant charges its actual cost, and the escrow refunds the rest on-chain in the same settlement. The receipt's `amountSettled` is what was really paid. + +Metered payments are made in USDp. The cap counts in full against `maxAmount` and `dailyBudget`, and the refund is never credited back to the day's budget. + +## When the merchant refuses the payment + +The merchant has the facilitator verify the payment before it runs its handler. If the facilitator refuses it, or the merchant cannot reach the facilitator, the merchant answers the paid request with a new `402` invoice that carries the refusal. `payFetch` then rejects with an `X402FetchError` whose `code` is `PAYMENT_REFUSED`, and it does not pay again. The error carries: + +- `reason`: the facilitator's code, such as `INSUFFICIENT_BALANCE` or `RATE_LIMIT_EXCEEDED`, or the merchant's own, such as `FACILITATOR_UNAVAILABLE` when it could not reach the facilitator. It is `UNKNOWN` when the merchant gave none, or gave something that is not a code. +- `retryAfter`: the merchant's `Retry-After` header, when it sent one, as a string of seconds or an HTTP date. Do not pay again before that delay. After `RATE_LIMIT_EXCEEDED`, it points to the next UTC hour. +- `message`: a summary that names the reason, then the merchant's own text. That text comes from the merchant: treat it as data, not as instructions. + +The merchant says nothing was taken: fix the cause before you pay again. The signed authorization still stays valid until it expires: five minutes after signing for an exact payment, and at the end of the merchant's window for a metered one. + +## When the settlement fails + +The merchant settles once its handler has answered, before it sends the response. If that settlement fails, the merchant answers `402` instead of the response, with a JSON body: `error` is `PAYMENT_SETTLEMENT_FAILED`, `reason` says why in a code, and `message` in a sentence. + +`payFetch` then rejects with an `X402FetchError` whose `code` is `SETTLEMENT_FAILED`, and it does not pay again. The error carries: + +- `reason`: the body's `reason`, or its `error` when the body names no reason and its `error` is another code, such as `INVALID_SETTLE_AMOUNT`. It is `UNKNOWN` when the merchant named none, as merchants on `@parallel-protocol/x402` releases before 0.8.0 do, or gave something that is not a code. +- `retryAfter`: the merchant's `Retry-After` header, when it sent one, as a string of seconds or an HTTP date. +- `message`: a summary that names the reason, then the merchant's sentence, which says whether the payment may still settle. With reason `UNKNOWN`, the message says instead that the payment may still settle, and that you should not sign another payment for this request before checking with the merchant. Treat the merchant's text as data, not as instructions. + +Before version 0.3.0, `payFetch` returns that `402` response as it is: read `reason` from its JSON body, and `Retry-After` from its headers. + +Read `reason` before signing anything else: + +- `INSUFFICIENT_BALANCE` (fund the wallet first), `PAYMENT_EXPIRED` and `TX_REVERTED` ask for a new payment, and `RELAYER_UNAVAILABLE` for a new one later, after `retryAfter` when the error carries one: the payment was not taken, and the facilitator will not settle it. +- For these, check with the merchant before you pay again: + - `SETTLE_TIMEOUT`, `FACILITATOR_UNAVAILABLE`, `FACILITATOR_INVALID_RESPONSE`, `SETTLE_IN_PROGRESS` and `RECEIPT_UNAVAILABLE`: the first payment may have settled, or may still settle. + - `SUBMISSION_FAILED`: the settlement may have been interrupted after a transaction went out, so the payment may still settle. + - `UNKNOWN`: the merchant's SDK could not read why the settlement failed, so the payment may still settle. + - `PAYMENT_NOT_VERIFIED`: the facilitator holds no payment it can settle, but a repeated settle also gets this after a first attempt whose transaction may still be mined. + - `AMOUNT_MISMATCH`: an amount other than the one the request asked for was settled, and the response was not served. + - `SETTLE_TOKEN_REQUIRED` and `SETTLE_TOKEN_INVALID`: the merchant could not complete the settlement, and the payment was not taken. + - `PARALLELIZER_PAUSED` and `SERVICE_UNAVAILABLE`: the facilitator refused before it sent anything, so the payment was not taken, but the merchant can still settle it until it expires. + - `AUTHORIZATION_USED`: the authorization was consumed or cancelled on-chain, and not by this facilitator. If someone else settled it, the merchant was paid. + +For any other reason, check with the merchant as well before you pay again. The [error codes](/agents/x402/error-codes) give the detail for each reason. + ## The safety model - **Nothing moves without a signature**, and the signature authorizes exactly one transfer, to one recipient, within a time window. - **`maxAmount` is enforced client-side** against a verified token catalog — a merchant cannot re-scale amounts or trick the agent into overpaying. - **You only pay for success.** The merchant settles the payment only when it serves a successful response; an API error means nothing is charged, and unsettled authorizations simply expire. +- **One payment settles once.** The facilitator claims a payment before it submits it, so the same authorization never settles twice. +- **One payment at a time.** A wrapper signs one payment at a time, which keeps `dailyBudget` exact, and it never retries a payment on its own. It does not set aside what it has signed: each payment is checked against the wallet's on-chain balance, which a signed payment lowers only when it settles. Two payments signed together can each fit a balance that covers only one. The chain still refuses a double spend, so the second settlement fails with `INSUFFICIENT_BALANCE`, possibly after the merchant has served the request. +- **The engine gets only what it needs.** The signing engine runs as a child process of your agent. It receives the key and the settings it needs to start and reach the chain: `ALCHEMY_API_KEY`, the system paths, and the runtime's own settings (proxy, certificates, TLS and OpenSSL, `NODE_OPTIONS`). Since version 0.3.0, the rest of your environment is not passed to it. That list does not cover files on disk: version 0.4.1 of `@parallel-protocol/cli` still loads a `.env` file from your agent's working directory or any parent directory, or, failing that, from where the CLI is installed or any parent directory, which finds your project's `.env`. +- **A payment can settle even when the paid retry fails on the network.** Treat non-idempotent paid requests accordingly. ## Next steps diff --git a/src/pages/agents/x402/concepts.mdx b/src/pages/agents/x402/concepts.mdx index 353acd7..fd96b71 100644 --- a/src/pages/agents/x402/concepts.mdx +++ b/src/pages/agents/x402/concepts.mdx @@ -15,11 +15,22 @@ You declare paid routes in your middleware; the facilitator handles the rest. Every paid request goes through two phases: -1. **Verify** — the facilitator checks the agent's signed payment off-chain. Instant, no transaction. If it's valid, your handler runs. -2. **Settle** — once your handler returns a success response, the facilitator submits the transfer on-chain and returns a settlement proof. +1. **Verify** — the facilitator checks the agent's signed payment off-chain: its shape, signature, nonce and expiry, and that it delivers the required token, for at least the price, to your `payTo` on the route's network. Instant, no transaction. If it's valid, your handler runs, and the facilitator hands the middleware a settle token for this payment. +2. **Settle** — once your handler returns a success response, the middleware presents that token, and the facilitator submits the transfer on-chain and returns a settlement proof. If verification fails, your handler never runs. If your handler fails, settlement never happens — the agent is only charged for a successful response. See [verify vs settle](/agents/x402/verify-vs-settle) for the full sequence. +Each payment settles once. The facilitator claims the payment before it submits anything, so two settles of the same payment never both reach the chain, and a settle repeated after a lost answer gets the recorded outcome: the confirmation, marked `alreadySettled`, or the refusal. A settle that does not present the token issued at verify is refused with `SETTLE_TOKEN_REQUIRED`, or `SETTLE_TOKEN_INVALID` for a wrong one: the facilitator has required the token since 1 October 2026, and `@parallel-protocol/x402` sends it from version 0.8.0. + +## Exact and metered payments + +A route is priced in one of two schemes: + +- **`exact`**, the default: the agent signs the price, and you receive it. +- **`upto`**, for a resource whose cost is only known once it is served, such as an LLM completion: the agent signs the price as a cap, valid for the route's `maxTimeoutSeconds` (3,600 at most). Your handler names the amount it actually charges, and the escrow refunds the rest on-chain in the same settlement. Metered routes are paid in USDp only. + +On a metered route the SDK keeps up to the last two minutes of that window for the settlement and its retry: on Express, Hono and Next.js the handler gets `maxTimeoutSeconds` minus 120 seconds, and 30 seconds at least. A settlement the facilitator confirms for another amount than the one your handler asked for is refused with `AMOUNT_MISMATCH` and the response is discarded. Alert on it: money moved, and the agent was not served. The configuration, with the `payment-settle-amount` header and the `meter` function, is in the [package README](https://www.npmjs.com/package/@parallel-protocol/x402). + ## Supported stablecoins By default a route accepts **USDp**, **USDC**, and **sUSDp**. The agent pays with whichever of these it holds; you receive the token you configured — including sUSDp, Parallel's yield-bearing savings token, so your revenue can start earning the moment it settles. You can narrow or widen the accepted set per route with the [`acceptedTokens`](/agents/x402/api-reference#routeconfig) option. diff --git a/src/pages/agents/x402/index.mdx b/src/pages/agents/x402/index.mdx index a74070d..87f1e0a 100644 --- a/src/pages/agents/x402/index.mdx +++ b/src/pages/agents/x402/index.mdx @@ -23,7 +23,7 @@ Parallel runs an **x402 facilitator** and ships drop-in middleware so any API ca - **Zero platform fee** — Parallel takes no cut of your revenue. - **Gas sponsored** on Base, HyperEVM, and Avalanche. - **Settles directly to your wallet** — non-custodial, no Parallel account. -- **MIT-licensed SDKs** — the middleware and the agent package are published on npm. +- **MIT-licensed SDKs** — the middleware, the agent package and the CLI that signs its payments are published on npm. ## Start here diff --git a/src/pages/agents/x402/quickstart.mdx b/src/pages/agents/x402/quickstart.mdx index 8e8936d..db5f854 100644 --- a/src/pages/agents/x402/quickstart.mdx +++ b/src/pages/agents/x402/quickstart.mdx @@ -16,6 +16,10 @@ This guide adds stablecoin payment support to an API. The same pattern works for npm install @parallel-protocol/x402 ``` +:::warning +Use version 0.8.1 or later. Since 1 October 2026 the facilitator settles a payment only when the settle presents the token it issued at verify, and versions before 0.8.0 do not send it: their settlements are refused with `SETTLE_TOKEN_REQUIRED`, and the agent gets a `402` instead of your response. Version 0.8.1 adds the facilitator URL checks of step 2. +::: + Install your framework separately — they are optional peer dependencies: ```bash @@ -26,6 +30,8 @@ npm install express # or: next · fastify · hono Point the middleware at the facilitator, then declare which routes are paid, at what price, on which network, and where funds should settle. +Write the facilitator's URL with https, as below. Since version 0.8.1, the SDK refuses any other URL with an `X402ConfigError` when the middleware is created, except plain http on `localhost`, `127.0.0.1` and `[::1]`: `http://agents.parallel.best` is refused. The SDK calls that address only and never follows a redirect, which fails the call with `FACILITATOR_UNAVAILABLE`. + @@ -56,17 +62,18 @@ app.listen(3000); ```ts // app/api/data/route.ts +import { NextResponse } from "next/server"; import { withPayment } from "@parallel-protocol/x402/next"; const config = { facilitator: { url: "https://agents.parallel.best" }, routes: { - "/api/data": { price: "0.10", network: "ethereum", payTo: "0xYourAddress" }, + "/api/data": { price: "0.10", network: "ethereum", payTo: "0xYourAddress" as const }, }, }; export const GET = withPayment(config, async (req) => { - return Response.json({ data: "protected content" }); + return NextResponse.json({ data: "protected content" }); }); ``` @@ -127,10 +134,11 @@ That's it. Your API now charges $0.01 per request to `/api/data`. Agents pay in When an agent calls your endpoint with a signed payment header: -1. The middleware sends the payload to the facilitator's `/x402/verify` endpoint — an instant, off-chain signature check. +1. The middleware sends the payload to the facilitator's `/x402/verify` endpoint — an instant, off-chain check of the signature, the amount, the token and the recipient. A valid payment comes back with a settle token, which the middleware keeps in memory. 2. If valid, **your handler runs** and produces the response. -3. If your handler returns a 2xx, the middleware calls `/x402/settle` — the on-chain transfer happens. +3. If your handler returns a 2xx, the middleware calls `/x402/settle` with that token — the on-chain transfer happens, once per payment. 4. If your handler fails, **no settlement happens** — the agent is not charged. +5. If the settlement fails, the agent gets a `402` with `PAYMENT_SETTLEMENT_FAILED` and a `reason` instead of your response. A settle that timed out or could not reach the facilitator is retried once first: repeating it is safe, since the facilitator answers with the recorded outcome. See the [error codes](/agents/x402/error-codes). Read more: [The verify / settle flow](/agents/x402/verify-vs-settle). diff --git a/src/pages/security/risks.mdx b/src/pages/security/risks.mdx index c95feda..ba73a28 100644 --- a/src/pages/security/risks.mdx +++ b/src/pages/security/risks.mdx @@ -29,7 +29,7 @@ Nothing on this page is financial, legal or tax advice. USDp is backed by other | Governance and key holders | Everyone | 5 of 8 multisigs, Snapshot votes, role timelocks, scoped guardian powers | [DAO Multisigs](/governance/dao-multisigs), [Emergency Guardians](/security/parallel-emergency-guardians) | | PRL price, staking penalties, LP exposure | PRL and sPRL holders | Cooldown instead of penalty if you wait the full 28 days, warnings in MCP transactions | [Staking Mechanisms](/governance/parallel-governance-token-prl/tokenomics/staking-mechanisms) | | Chain and infrastructure outage | Everyone on that chain | Independent deployments per chain, isolation mode available on the bridge, Sonic wind-down | [Implementation](/products/parallel-v3/stablecoins-and-savings/usdp-and-susdp/implementation) | -| x402 facilitator outage or failure | Agents paying with x402, merchants accepting it | Off-chain verify then on-chain settle, nothing charged on failure, non-custodial settlement, nonce and expiry on every authorization | [How the facilitator works](/agents/x402/concepts), [Verify vs settle](/agents/x402/verify-vs-settle) | +| x402 facilitator outage or failure | Agents paying with x402, merchants accepting it | Off-chain verify then on-chain settle, nothing charged on failure, one settlement per payment, bound to the merchant that verified, non-custodial settlement, nonce and expiry on every authorization | [How the facilitator works](/agents/x402/concepts), [Verify vs settle](/agents/x402/verify-vs-settle) | | Signing a bad transaction from an AI tool | MCP and CLI users | The MCP server never signs; it returns unsigned, simulated transactions with warnings for you to review | [How MCP transactions work](/agents/mcp/transactions) | ## 1. Collateral and backing risk @@ -212,8 +212,8 @@ Off-chain services (the app, the MCP server, subgraphs, the proof-of-solvency da Parallel runs an **x402 facilitator**: an off-chain service that verifies an agent's signed payment, then settles it on-chain, so any API can charge AI agents per request. Two facts matter before you depend on it: -- **The facilitator is not audited and not open source.** The audits on the [audits page](/security/audits) (Bail Security, Cyfrin, Certora) cover the protocol smart contracts the settlement goes through, not the hosted service itself. The middleware and agent SDKs are MIT-licensed on npm; the facilitator is a closed service operated by Parallel. -- **It is a single dependency.** If it is down, slow (the SDK times out after 10 seconds on `verify`, 60 on `settle`) or misbehaving, agents cannot pay and merchants cannot get paid until it recovers. +- **The facilitator is not audited and not open source.** The audits on the [audits page](/security/audits) (Bail Security, Cyfrin, Certora) cover the protocol smart contracts the settlement goes through, not the hosted service itself. The middleware, the agent SDK and the CLI are MIT-licensed on npm; the facilitator is a closed service operated by Parallel. +- **It is a single dependency.** If it is down, slow (the SDK times out after 10 seconds on `verify` and 60 on `settle`, and retries a settle once when it timed out or could not reach the facilitator) or misbehaving, agents cannot pay and merchants cannot get paid until it recovers. An agent can pay in USDp, USDC or sUSDp only, with gas sponsored on Base, HyperEVM and Avalanche (1,000 transactions per agent per month); on Ethereum it pays its own gas. A leaked agent key drains whatever that wallet holds, and a token-swapping settlement fails when the Parallelizer is paused (`PARALLELIZER_PAUSED`). @@ -221,9 +221,10 @@ The **MCP server** and **CLI** are a different dependency: the MCP server never ### How Parallel mitigates it -- **Verify, then settle.** The facilitator checks the signature off-chain before the merchant's handler runs, and submits the on-chain transfer only after a success response; a failed request is never charged, and a settle without a prior verify (or after the 120-second verify window) is rejected. See [verify vs settle](/agents/x402/verify-vs-settle). +- **Verify, then settle.** The facilitator checks the signature off-chain before the merchant's handler runs, and submits the on-chain transfer only after a success response; a failed request is never charged. A settle must present the token the facilitator issued at verify for that payment, required since 1 October 2026, and a settle without a verified payment is rejected. See [verify vs settle](/agents/x402/verify-vs-settle). +- **One settlement per payment.** The facilitator claims a payment before it submits anything, so the same payment never settles twice, and a settle repeated after a lost answer gets the recorded outcome instead of a second transfer. - **Non-custodial.** Funds settle straight to the merchant's `payTo` wallet: the facilitator never holds them, so there is nothing to withdraw or lose if it disappears; an unsettled authorization simply expires. -- **Bounded authorizations.** Every payment carries an amount, a chain, an expiry and a nonce; replays, expired signatures and chain mismatches are rejected and each signer is rate-limited hourly. See the [error codes page](/agents/x402/error-codes). +- **Bounded authorizations.** Every payment carries an amount, a chain, an expiry and a nonce; replays, expired signatures and chain mismatches are rejected and each signer is rate-limited hourly. Verify also refuses a payload that does not have its route's shape, does not deliver the asset the merchant requires, or does not pay the merchant's `payTo`. See the [error codes page](/agents/x402/error-codes). - **Audited settlement path.** The contracts that move tokens are the audited protocol contracts; gas sponsoring alone cannot move funds. - **Unsigned by design.** Every MCP write tool simulates the transaction and returns `simulation.success`, a revert reason on failure, and business warnings before you sign, such as the staking warnings in section 7. See [how MCP transactions work](/agents/mcp/transactions). @@ -231,7 +232,7 @@ The **MCP server** and **CLI** are a different dependency: the MCP server never - **Keep agent wallets small.** Fund an agent with only what it needs next and top it up, rather than holding a treasury behind a server-side key; use a dedicated wallet for the CLI, never your main one. - **Confirm settlement yourself.** Merchant [webhooks](/agents/x402/webhooks) are on the roadmap, not live: read the `payment-response` header (it carries the on-chain `txHash`) or watch your `payTo` wallet before treating a request as paid. -- **Handle the facilitator being down.** Catch `FACILITATOR_UNAVAILABLE` and `FACILITATOR_INVALID_RESPONSE` and decide whether to fail closed or serve unpaid. +- **Handle the facilitator being down.** Catch `FACILITATOR_UNAVAILABLE` and `FACILITATOR_INVALID_RESPONSE` (and `SETTLE_TIMEOUT` when you call the facilitator client yourself) and decide whether to fail closed or serve unpaid. Behind the middleware, a failed settlement answers the agent `402` with `PAYMENT_SETTLEMENT_FAILED` and a `reason`; alert on `AMOUNT_MISMATCH`, which means a metered settlement was confirmed for another amount than the one asked. - **Treat the facilitator as a vendor.** If your business cannot tolerate an unaudited hosted service, settle against the audited contracts yourself. - **Read before you sign.** Inspect the `to`, `chainId`, `value` and warnings of every transaction an MCP client shows you, and replace the default unlimited approval with an exact one if you prefer.