Documentation Index
Fetch the complete documentation index at: https://docs-test.rye.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
← x402
402 → sign → retry loop transparently, so your code reads like a normal HTTP call.
Prerequisites
- An AgentCash wallet with a small USDC balance on Base (≥ $1 is plenty for testing — covers the access fees and a low-priced test purchase)
- A product URL from a supported merchant (Shopify, Amazon, etc.)
- The AgentCash CLI or SDK — follow the AgentCash setup guide to install and initialize a wallet
~/.agentcash/wallet.json (EVM) and ~/.agentcash/solana-wallet.json (Solana). Top up the wallet with USDC on the network you plan to use before making any paid call.
End-to-end purchase
The example below uses AgentCash’swallet.fetch, which is a fetch-compatible function that automatically signs and retries 402 responses.
What happens behind the scenes
wallet.fetchreceives a402 Payment Requiredfrom the proxy with aPAYMENT-REQUIREDheader. It signs an EIP-3009 USDC transfer for the requested amount and retries the same request with aPAYMENT-SIGNATUREheader.- For step 1 the signed transfer is for 0.03 API fee — bundled into a single signed transfer.
GETcalls in steps 2 and 5 are free and use a normalfetch. TheX-Wallet-Addressheader scopes the read to the wallet that paid for the intent.- After step 4 returns, Rye places the order asynchronously. The intent moves to
placing_order, then tocompletedorfailed. See Checkout Intent Lifecycle for the full state machine.
Timing
| Step | Typical latency |
|---|---|
| Create intent (incl. on-chain finality) | 1–3 s |
| Offer retrieval | 5–20 s |
| Confirm | < 1 s after signature |
| Order placement | 30 s – several min |
GET /v1/checkout-intents/:id until you see state: "completed" or state: "failed".
Failure modes
- Insufficient wallet balance — the on-chain transfer fails; the intent moves to
failedand no order is placed. - Offer retrieval fails (out of stock, unsupported product) —
state: "failed"after step 2; the $0.02 access fee is not refunded because the offer retrieval work was performed. - Order placement fails at the merchant —
state: "failed"after step 4; the purchase amount is automatically refunded to the signing wallet on-chain. - Signature expired between calls — the retry returns
400with a freshPAYMENT-REQUIRED;wallet.fetchre-signs and retries automatically.

