TypeScript-style x402 v2 settlement adapter for XRPL in Python: issue challenges, build payment memos, verify on-ledger settlement, replay-safe.
x402-xrpl-python is an early-stage Python project in the AI payments / x402 ecosystem, focused on http-402, payment, rlusd, settlement. It currently has 0 GitHub stars and 0 forks, and sits alongside related tools like vscode-x402, x402-payments-mcp, routex, x402-Whitepaper, ProwlFi, awesome-x402.
Strict server-side settlement verifier for x402 v2 payments on XRPL.
This package validates presigned XRPL Payment transactions and turns them into deterministic, replay-safe x402 settlement receipts for HTTP 402 flows.
Designed for backend services that require strong guarantees around:
paymentIdpaymentId <-> txHash invariant)Paths / SendMax / DeliverMin)DestinationTag support)A strict verification layer that converts an XRPL Payment transaction into a validated x402 v2 settlement result.
It enforces deterministic settlement rules suitable for:
This is the server-side enforcement layer.
Minimal by design:
create_challenge(...)verify_settlement(...)InMemoryReplayStoreSettlementVerificationErrorOptional helpers (stdlib-only; core stays dependency-free):
fetch_transaction_jsonrpc(network_url, tx_hash) — minimal RPC fetchx402_xrpl_adapter.rpc.XrplJsonRpcClient — wrapper for verify_settlement callbackgit clone https://github.com/naory/x402-xrpl-python.git
cd x402-xrpl-python
python3 -m pip install ".[dev]"
PYTHONPATH=src python3 -m pytest
from x402_xrpl_adapter import create_challenge
challenge = create_challenge(
network="xrpl:testnet",
amount="2.5",
asset={"kind": "XRP"},
destination="rDestinationAddress...",
expires_at="2026-02-17T12:00:00Z",
payment_id="PAYMENT-001",
)
import base64
import json
from x402_xrpl_adapter import InMemoryReplayStore, verify_settlement
receipt_header_value = base64.b64encode(
json.dumps(
{
"network": challenge["network"],
"txHash": "ABCDEF123...",
"paymentId": challenge["paymentId"],
}
).encode("utf-8")
).decode("utf-8")
def fetch_transaction(network: str, tx_hash: str):
del network, tx_hash
return {
"validated": True,
"TransactionType": "Payment",
"Account": "rSender...",
"Destination": challenge["destination"],
"Amount": "2500000", # 2.5 XRP in drops
"Memos": [
{
"Memo": {
"MemoType": "78343032", # "x402"
"MemoFormat": "6170706c69636174696f6e2f6a736f6e", # "application/json"
"MemoData": "7b2276223a312c2274223a2278343032222c227061796d656e744964223a225041594d454e542d303031227d",
}
}
],
}
result = verify_settlement(
challenge=challenge,
receipt_header_value=receipt_header_value,
fetch_transaction=fetch_transaction,
replay_store=InMemoryReplayStore(),
)
assert result["ok"] is True
Second call with the same paymentId + txHash returns idempotent success.
Minimal stdlib-only helpers. Core verifier stays dependency-free.
Function — fetch_transaction_jsonrpc(network_url, tx_hash):
from x402_xrpl_adapter import fetch_transaction_jsonrpc
tx = fetch_transaction_jsonrpc("https://s.altnet.rippletest.net:51234", "ABCDEF123...")
# returns dict or None
Class — XrplJsonRpcClient for use as verify_settlement callback:
from x402_xrpl_adapter.rpc import XrplJsonRpcClient
client = XrplJsonRpcClient("https://s.altnet.rippletest.net:51234")
result = verify_settlement(
challenge=challenge,
receipt_header_value=receipt_header_value,
fetch_transaction=client.fetch_transaction,
replay_store=InMemoryReplayStore(),
)
Client -> 402 Challenge -> XRPL Payment (presigned)
-> txHash + receipt header
Server -> x402-xrpl-settlement-adapter-py
-> fetch_transaction(network, tx_hash)
-> deterministic validation
-> settlement accepted/rejected
Strict validation rules:
paymentIdpaymentId <-> txHash)This prevents replay, redirection, partial delivery, and path manipulation attacks.
Python runs a shared canonical vector suite from the TS repository.
../x402-xrpl/conformance/test_vectors.jsonX402_TEST_VECTORS_PATH=/absolute/path/to/test_vectors.json PYTHONPATH=src python3 -m pytest
PYTHONPATH=src python3 -m pytest
python3 -m ruff check .
python3 -m build
python3 -m twine check dist/*
MIT
Pay for APIs, unlock content, and settle x402 micropayments right inside VS Code.
Give AI agents a wallet — x402 payment tools over Model Context Protocol.
Multi-chain settlement cost router for the x402 payment protocol. Selects the cheapest or fastest blockchain for each AI agent micropayment.
Notes and guides for implementing x402 micropayments on APIs.
The world's first privacy layer for AI agents on Solana — stealth addresses + x402 payments. Every payment lands at a fresh, unlinkable address.
🚀 Curated list of x402 resources: HTTP 402 Payment Required protocol for blockchain payments, crypto micropayments, AI agents, API monetization. Includes SDKs (TypeScript, Python, Rust), examples, facilitators (Coinbase, Cloudflare), MCP integration, tutorials. Accept USDC payments with one line of code. Perfect for AI agent economy.
Production-ready x402 facilitator server.
Rust SDK for the x402 payment protocol.
Accept payments from AI agents. Open-source. Your data, your domain, your rules. Free forever.
A production-ready payment settlement service for the x402 protocol. Built with Elysia and Node.js, it verifies cryptographic payment signatures and settles transactions on-chain for EVM, SVM (Solana), and Starknet networks.
Golang implementation of an x402 payment facilitator
x402 payment facilitator — verifies and settles EIP-3009 USDC micropayments on Base, Arbitrum, and Ethereum.