{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/es-ES/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Agentic Payments with X402 on the XRP Ledger","siteUrl":"https://xrpl.org/","llmstxt":{"hide":false,"title":"XRPL Developer Portal & Documentation","description":"Explore XRP Ledger documentation, blogs, and other blockchain developer resources needed to start building and integrating with the ledger.","details":{"content":"XRP Ledger concepts, use cases, tutorials, references, and other blockchain developer resources. Also, stay up to date with release announcements and more through the XRPL Blog."},"sections":[{"title":"Introduction","description":"A high-level introduction to the XRP Ledger.","includeFiles":["docs/introduction/**/*.*","about/faq.md"],"excludeFiles":["docs/introduction/index.md"]},{"title":"Use Cases","description":"Real-world applications and business scenarios for the XRP Ledger.","includeFiles":["docs/use-cases/**/*.*"],"excludeFiles":["docs/use-cases/index.md","docs/use-cases/defi/index.md"]},{"title":"Agentic Transactions","description":"XRPL AI Starter Kit to help autonomous agents discover, set up, and execute agentic transactions on the XRP Ledger.","includeFiles":["docs/agents/**/*.*"],"excludeFiles":[]},{"title":"Concepts","description":"Core concepts including accounts, tokens, transactions, consensus, and more.","includeFiles":["docs/concepts/**/*.*"],"excludeFiles":["docs/concepts/index.md","docs/concepts/decentralized-storage/index.md","docs/concepts/payment-types/index.md"]},{"title":"Tutorials","description":"Step-by-step guides for building on the XRP Ledger in JavaScript, Python, Go, and more.","includeFiles":["docs/tutorials/**/*.*"],"excludeFiles":[]},{"title":"References","description":"Protocol specification, transaction types, ledger entries, and API methods.","includeFiles":["docs/references/**/*.*"],"excludeFiles":["docs/references/xrp-api.md","docs/references/data-api.md","docs/references/protocol/index.md","docs/references/protocol/ledger-data/ledger-entry-types/index.md","docs/references/protocol/transactions/index.md","docs/references/protocol/transactions/types/index.md","docs/references/http-websocket-apis/api-conventions/index.md","docs/references/http-websocket-apis/public-api-methods/*/index.md","docs/references/http-websocket-apis/admin-api-methods/*/index.md"]},{"title":"Infrastructure","description":"Install, configure, and troubleshoot rippled and Clio servers.","includeFiles":["docs/infrastructure/**/*.*"],"excludeFiles":["docs/infrastructure/index.md","docs/infrastructure/*/index.md","docs/infrastructure/installation/build-run-rippled-in-reporting-mode.md","docs/infrastructure/configuration/data-retention/index.md","docs/infrastructure/configuration/server-modes/index.md"]},{"title":"Blog (2023+)","description":"Recent XRPL Blog posts (showing 2023 and newer).","includeFiles":["blog/2023/**/*.*","blog/2024/**/*.*","blog/2025/**/*.*","blog/2026/**/*.*"],"excludeFiles":[]},{"title":"Resources","description":"Developer resources and contribution guidelines.","includeFiles":["resources/**/*.*"],"excludeFiles":["resources/index.md"]}],"excludeFiles":[]},"description":"Enable AI agents to pay for and monetize HTTP-based services using the X402 protocol on the XRP Ledger. Step-by-step quickstart for merchants and payer agents, with Python code samples using the x402-xrpl package.\n"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"agentic-payments-with-x402-on-the-xrp-ledger","__idx":0},"children":["Agentic Payments with X402 on the XRP Ledger"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["X402 is an open protocol for HTTP-native machine-to-machine payments. It extends the existing HTTP 402 Payment Required status code into a complete payment flow: a service responds with its payment requirements, a client fulfills them with an on-chain transaction, and the service delivers the resource."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For AI agents, X402 means that paying for an API call or AI model inference is just another HTTP request — no human in the loop, no billing dashboard, no API key rotation. An agent can discover a paywall, pay for access, and retry, all in a single workflow step."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The XRP Ledger is a supported settlement chain in the X402 ecosystem via an implementation contributed by T54. This means agents using the XRP Ledger can pay for X402-gated services using XRP or RLUSD on day one."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["About the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x402-xrpl"]}," package"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x402-xrpl"]}," package is maintained by ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://xrpl-x402.t54.ai"},"children":["T54"]}," and is the reference implementation of X402 for the XRP Ledger. It is available on ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://pypi.org/project/x402-xrpl/"},"children":["PyPI"]},". The package is early-stage; review the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://xrpl-x402.t54.ai/docs"},"children":["T54 changelog"]}," and pin a specific version in production rather than installing latest. The testnet facilitator at ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["xrpl-facilitator-testnet.t54.ai"]}," is operated by T54 on a best-effort basis with no committed SLA; do not build production systems against it."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-x402-works-on-the-xrp-ledger","__idx":1},"children":["How X402 works on the XRP Ledger"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The X402 flow on the XRP Ledger involves three parties: a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["merchant"]}," (a service that"," ","requires payment), a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["payer agent"]}," (a client that pays for access), and a"," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["facilitator"]}," (a service that verifies the on-chain payment and issues a signed"," ","receipt the merchant trusts)."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The complete flow:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Agent requests a resource"]}," — the agent calls a protected HTTP endpoint."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Merchant returns 402"]}," — the response includes the price, the payment address, and the facilitator URL in a structured header."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Agent sends a presigned on-chain transaction"]}," — the agent submits a presigned XRP Ledger Payment transaction from the client to the merchant's wallet address for the required amount."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Agent obtains a receipt"]}," — the agent submits the transaction hash to the facilitator, which verifies the on-chain payment and issues a signed receipt."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Agent retries with receipt"]}," — the agent re-sends the original request with the receipt in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-PAYMENT"]}," header."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Merchant delivers"]}," — the merchant verifies the receipt and returns the resource."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The XRP Ledger's deterministic finality means step 3 is reliable: the agent knows"," ","within 3–5 seconds whether the payment confirmed, and a clean expiry means no ambiguous"," ","state to handle."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"../img/x402-sequence-light.svg","alt":"X402 payment sequence diagram showing the end-to-end flow between Agent, Merchant, XRP Ledger, and Facilitator"},"children":[]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":2},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Python 3.11+"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["An XRPL wallet with a testnet balance. If you do not have one, use the"," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://xrpl.org/resources/dev-tools/xrp-faucets"},"children":["XRPL Testnet Faucet"]}," to create"," ","and fund one in seconds."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Basic familiarity with HTTP APIs."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"merchant-quickstart-accept-x402-payments","__idx":3},"children":["Merchant quickstart: accept X402 payments"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This section shows how to protect an HTTP endpoint so that clients must pay before"," ","receiving a response."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-1-install-dependencies","__idx":4},"children":["Step 1: Install dependencies"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sh","header":{"controls":{"copy":{}}},"source":"pip install fastapi uvicorn x402-xrpl python-dotenv\n","lang":"sh"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-2-configure-environment","__idx":5},"children":["Step 2: Configure environment"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," file with your merchant configuration:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"dotenv","header":{"controls":{"copy":{}}},"source":"XRPL_FACILITATOR_URL=https://xrpl-facilitator-testnet.t54.ai\nXRPL_PAY_TO=rYourWalletAddress   # Your wallet address to receive payments.\nXRPL_PRICE_DROPS=1000            # Price in drops (1 XRP = 1,000,000 drops).\nXRPL_SOURCE_TAG=20260601         # Stamped on every on-chain payment for this endpoint.\n","lang":"dotenv"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["XRPL_FACILITATOR_URL"]}," above is T54's public testnet facilitator. For Mainnet,"," ","T54 operates a separate facilitator endpoint — see"," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://xrpl-x402.t54.ai/docs"},"children":["T54's X402 documentation"]}," for the current URLs."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-3-create-your-server","__idx":6},"children":["Step 3: Create your server"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a file called ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["server.py"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"import os\nfrom dotenv import load_dotenv\nfrom fastapi import FastAPI\nfrom x402_xrpl.server import require_payment\n\nload_dotenv()\n\napp = FastAPI()\n\n# Protect the /hello endpoint with the x402 payment middleware.\n# Requests that do not include a valid payment receipt receive a 402 response\n# containing the payment requirements.\n#\n# extra={\"sourceTag\": ...} stamps every on-chain Payment that pays this\n# endpoint with the given SourceTag, so you can filter and measure usage via\n# any XRPL data API or block explorer.\n# See /docs/agents/track-agent-behavior/ for more.\napp.middleware(\"http\")(\n    require_payment(\n        path=\"/hello\",\n        price=os.getenv(\"XRPL_PRICE_DROPS\", \"1000\"),\n        pay_to_address=os.getenv(\"XRPL_PAY_TO\"),\n        facilitator_url=os.getenv(\"XRPL_FACILITATOR_URL\"),\n        network=\"xrpl:1\",   # xrpl:1 = Testnet, xrpl:0 = Mainnet\n        asset=\"XRP\",\n        description=\"A paid hello world endpoint\",\n        extra={\"sourceTag\": int(os.getenv(\"XRPL_SOURCE_TAG\", \"20260601\"))},\n    )\n)\n\n\n@app.get(\"/hello\")\nasync def hello():\n    \"\"\"Protected endpoint — requires payment.\"\"\"\n    return {\"message\": \"Hello World! Thanks for the payment.\"}\n\n\n@app.get(\"/health\")\nasync def health():\n    \"\"\"Free endpoint — no payment required.\"\"\"\n    return {\"status\": \"ok\"}\n\n\nif __name__ == \"__main__\":\n    import uvicorn\n    uvicorn.run(app, host=\"0.0.0.0\", port=8000)\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-4-run-the-server","__idx":7},"children":["Step 4: Run the server"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sh","header":{"controls":{"copy":{}}},"source":"python server.py\n","lang":"sh"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Visit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://localhost:8000/hello"]},". Without a valid payment receipt in the request,"," ","you will receive a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["402 Payment Required"]}," response with the payment requirements encoded"," ","in the response headers. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/health"]}," endpoint remains free and accessible without"," ","payment."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"payer-agent-quickstart-pay-for-access","__idx":8},"children":["Payer agent quickstart: pay for access"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This section shows how to build a Python agent that detects a 402 response, signs and"," ","submits an XRP payment automatically, and retries the original request with proof of"," ","payment — all without any manual intervention."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-1-install-dependencies-1","__idx":9},"children":["Step 1: Install dependencies"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sh","header":{"controls":{"copy":{}}},"source":"pip install requests xrpl-py x402-xrpl python-dotenv\n","lang":"sh"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-2-configure-environment-1","__idx":10},"children":["Step 2: Configure environment"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," file with your wallet and target endpoint:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"dotenv","header":{"controls":{"copy":{}}},"source":"XRPL_BUYER_SEED=sYourWalletSeed                        # Your wallet seed — keep secret.\nXRPL_TESTNET_RPC_URL=https://s.altnet.rippletest.net:51234/\nRESOURCE_URL=http://localhost:8000/hello               # The paid endpoint to call.\n","lang":"dotenv"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["NOTE: ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Never commit your wallet seed to version control."]}," Use environment variables or a secrets manager. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/agents/getting-started-with-agentic-transactions/#step-2-generate-and-secure-your-wallet"},"children":["Step 2: Generate and secure your wallet"]}," for guidance."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-3-create-your-client","__idx":11},"children":["Step 3: Create your client"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a file called ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client.py"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"import os\nimport json\nfrom dotenv import load_dotenv\nfrom xrpl.wallet import Wallet\nfrom x402_xrpl.clients import x402_requests, decode_payment_response\n\nload_dotenv()\n\n# Load your wallet from the environment — never hardcode the seed.\nbuyer = Wallet.from_seed(os.getenv(\"XRPL_BUYER_SEED\"))\nprint(f\"Buyer address: {buyer.classic_address}\")\n\n# x402_requests wraps the standard requests library.\n# It automatically handles any 402 response: signs the required payment,\n# includes it in the retry, and returns the final response to your code.\n# The SourceTag stamped on the on-chain Payment is the one the merchant\n# declares in its payment requirements (see Merchant Step 3 above).\nsession = x402_requests(\n    buyer,\n    rpc_url=os.getenv(\"XRPL_TESTNET_RPC_URL\"),\n    network_filter=None,      # Accept any network declared by the server.\n    scheme_filter=\"exact\",    # Use the exact payment scheme.\n)\n\n# Make the request. If the server returns 402, the session handles it transparently.\nresource_url = os.getenv(\"RESOURCE_URL\")\nprint(f\"Requesting: {resource_url}\")\n\nresponse = session.get(resource_url, timeout=180)\nprint(f\"Status  : {response.status_code}\")\nprint(f\"Response: {response.text}\")\n\n# The server includes payment settlement details in the PAYMENT-RESPONSE header.\npayment_response = response.headers.get(\"PAYMENT-RESPONSE\")\nif payment_response:\n    decoded = decode_payment_response(payment_response)\n    print(\"\\nPayment settled!\")\n    print(json.dumps(decoded, indent=2))\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"step-4-run-the-client","__idx":12},"children":["Step 4: Run the client"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sh","header":{"controls":{"copy":{}}},"source":"python client.py\n","lang":"sh"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The client automatically:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Requests the protected endpoint"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Receives a 402 with payment requirements"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Signs and submits the XRP payment on-chain"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Retries the original request with the payment receipt"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Returns the response once the server verifies settlement"]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide currently includes Python examples only."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"protecting-an-agentic-workflow-end-to-end","__idx":13},"children":["Protecting an agentic workflow end-to-end"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Because ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x402_requests"]}," returns a standard ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["requests"]},"-compatible session, you can drop"," ","it in anywhere your agent makes HTTP calls. The agent's main logic issues ordinary"," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["session.get()"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["session.post()"]}," calls; any 402 response is handled transparently"," ","without the agent needing to know about the payment flow."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A prompt that uses the XRPL skills to wire this up:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"I'm building an agent that calls three external APIs. Two of them are X402-protected\nand accept XRP on testnet. Use x402_requests from x402_xrpl.clients to create a\nsession that handles 402 responses automatically. Load the wallet seed from\nXRPL_BUYER_SEED and the RPC URL from XRPL_TESTNET_RPC_URL. My agent code should\njust call session.get() and session.post() without any payment logic in the\nmain workflow.\n"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"pricing-guidance","__idx":14},"children":["Pricing guidance"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["X402 prices on the XRP Ledger are expressed in ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["drops"]}," (the smallest unit of XRP;"," ","1 XRP = 1,000,000 drops)."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Use case"},"children":["Use case"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Suggested price"},"children":["Suggested price"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Notes"},"children":["Notes"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Free tier / trial"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["0 drops"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Use for health checks and public endpoints"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Lightweight API call"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["100–1,000 drops"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["~$0.00003–$0.0003 at $0.30/XRP"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Standard data query"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["1,000–10,000 drops"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["~$0.0003–$0.003"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Compute-intensive / AI inference"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["10,000–100,000 drops"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["~$0.003–$0.03"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For dollar-denominated pricing with price stability, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x402-xrpl"]}," supports RLUSD."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"moving-to-mainnet","__idx":15},"children":["Moving to Mainnet"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Switching from testnet to Mainnet requires three changes:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Network parameter"]}," — change ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["network=\"xrpl:1\""]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["network=\"xrpl:0\""]}," in both"," ","merchant and client configuration."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Facilitator URL"]}," — replace the testnet facilitator URL with the Mainnet endpoint."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Wallet"]}," — fund a Mainnet wallet with real XRP and update ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["XRPL_PAY_TO"]}," ","(merchant) and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["XRPL_BUYER_SEED"]}," (payer) accordingly."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No other code changes are required. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["x402-xrpl"]}," package handles the network"," ","difference transparently."]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"where-to-go-next","__idx":16},"children":["Where to go next"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/agents/getting-started-with-agentic-transactions/"},"children":["Getting Started with Agentic Transactions"]}," —"," ","The full tutorial for setting up the XRPL skills and sending your first payment."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/agents/track-agent-behavior"},"children":["Track and Measure Agent Behavior"]}," —"," ","Using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SourceTag"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Memos"]}," to attribute and audit agent payments."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://xrpl-x402.t54.ai/docs"},"children":["T54 X402 Documentation"]}," — The full X402 reference for"," ","the XRPL implementation, including the exact payment scheme and facilitator API."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/x402-foundation/x402"},"children":["X402 Protocol Repository"]}," — The official X402 repository."]}]}]},"headings":[{"value":"Agentic Payments with X402 on the XRP Ledger","id":"agentic-payments-with-x402-on-the-xrp-ledger","depth":1},{"value":"How X402 works on the XRP Ledger","id":"how-x402-works-on-the-xrp-ledger","depth":2},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"Merchant quickstart: accept X402 payments","id":"merchant-quickstart-accept-x402-payments","depth":2},{"value":"Step 1: Install dependencies","id":"step-1-install-dependencies","depth":3},{"value":"Step 2: Configure environment","id":"step-2-configure-environment","depth":3},{"value":"Step 3: Create your server","id":"step-3-create-your-server","depth":3},{"value":"Step 4: Run the server","id":"step-4-run-the-server","depth":3},{"value":"Payer agent quickstart: pay for access","id":"payer-agent-quickstart-pay-for-access","depth":2},{"value":"Step 1: Install dependencies","id":"step-1-install-dependencies-1","depth":3},{"value":"Step 2: Configure environment","id":"step-2-configure-environment-1","depth":3},{"value":"Step 3: Create your client","id":"step-3-create-your-client","depth":3},{"value":"Step 4: Run the client","id":"step-4-run-the-client","depth":3},{"value":"Protecting an agentic workflow end-to-end","id":"protecting-an-agentic-workflow-end-to-end","depth":2},{"value":"Pricing guidance","id":"pricing-guidance","depth":2},{"value":"Moving to Mainnet","id":"moving-to-mainnet","depth":2},{"value":"Where to go next","id":"where-to-go-next","depth":2}],"frontmatter":{"seo":{"title":"Agentic Payments with X402 on the XRP Ledger","description":"Enable AI agents to pay for and monetize HTTP-based services using the X402 protocol on the XRP Ledger. Step-by-step quickstart for merchants and payer agents, with Python code samples using the x402-xrpl package.\n"},"labels":["AI","Agents","Payments","X402"]},"editPage":{"to":"https://github.com/XRPLF/xrpl-dev-portal/tree/master/docs/agents/agentic-payments-x402.md"},"lastModified":"2026-06-10T00:07:05.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/es-es/docs/agents/agentic-payments-x402","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}