Skip to content
· 7 min LIVE

We Put an XRP Paywall on a Live API - and a Script Paid It With Real Money

EPIC-210 Sluzen XRPL rail, live on agentbadge.xyz: GET /api/sluzen-pilot answers HTTP 402 with a machine-readable PAYMENT-REQUIRED invoice; the caller signs an XRP payment, retries with PAYMENT-SIGNATURE, and the Sluzen facilitator verifies and settles on XRPL testnet (xrpl:1). Replay of a spent signature returns the same txHash. Fail-closed verdicts, no keys on the server, and audit-hardened guards on the payment boundary.

AB
AgentBadge Team
Agency for the Agentic Web
We Put an XRP Paywall on a Live API - and a Script Paid It With Real Money
🤖 For AI agents: Machine-readable: JSON Markdown llms.txt Agent Guide

AgentBadge now answers GET /api/sluzen-pilot with HTTP 402 unless the caller has already paid in XRP. The gate does not run a node or verify signatures: it asks the Sluzen facilitator a typed question and believes the answer. Unpaid calls get a machine-readable invoice in the PAYMENT-REQUIRED header (xrpl:1, 1000 drops, issuer destination); paid calls return the resource plus a settled txHash; replayed signatures return the same txHash - dedupe, not a second charge. Verified end-to-end on production with real XRPL testnet transactions.

The problem: machines cannot fill in checkout forms

This is part of the Arc campaign series. Previous published episode: the ledger learning to say "partial" instead of guessing (EPIC-236). This article is EPIC-210: a second payment rail - XRP on XRPL via the Sluzen facilitator - proving the x402 surface is chain-agnostic, not Hedera-shaped.

Every paid API you know assumes a human somewhere: sign up, add a card, get an API key, get invoiced. AgentBadge sells to a different buyer - software agents that fetch, evaluate, and pay on their own. An agent cannot click "add payment method". What it can do is read a price, sign a transaction, and retry the request with proof attached.

HTTP reserved a status code for exactly this in 1997: 402 Payment Required. It sat unused for decades because nobody specified how the payment part works. The x402 protocol is that specification: the server answers 402 with a machine-readable invoice in a header, the client pays on-chain, then retries with a PAYMENT-SIGNATURE header carrying the signed proof. No accounts, no cards, no invoices.

For a junior: think of a vending machine that prints the price on a receipt slot instead of a screen. You read the receipt, put the coin in, and the receipt becomes the token that releases the item. The 402 response is the receipt-that-becomes-a-token. Nothing here needs a browser.

We already run this flow for HBAR and USDC on other endpoints (the x402 gateway). EPIC-210 asked the obvious next question: does the gate care which coin goes in the slot? If the answer is no, adding XRP should be a new rail, not a new payment system.

What shipped: one pilot route, one gate, one facilitator

GET /api/sluzen-pilot is a deliberately boring resource - a JSON payload saying "this resource was paid with XRP on xrpl:1". Boring is the point: everything interesting happens in the gate in front of it.

The gate does not verify signatures itself. It talks to Sluzen, a facilitator service for x402-style payments, in what their console calls facilitator mode: our server sends the caller's payment signature to POST /facilitator/settle (or /challenge for unsigned requests), Sluzen checks it against its route registry, settles the XRP on the ledger, and returns a typed verdict plus the transaction hash. Sluzen never calls back to our origin - the "resource URL" registered with them is a string identifier, not a webhook. That is why this integration needed zero DNS work.

Three facts that shaped the build:

The server stores no keys. The buyer signs from their own wallet. Settlement goes to a separate issuer address (rNFTtkgvyWy69pXp9NnA5CYha2rV97tAzn) we control, but the server never sees its seed - the route is registered on Sluzen's side.
Price floor on trial is 0.001 XRP (1000 drops). That is what the pilot charges.
Trial scope. Our Sluzen key is a 14-day issuer-testnet trial claimed 2026-11-28: one active route, testnet only, expires 2026-12-12. Everything in this article is inside that scope, said plainly.

A cross-section of a narrow security checkpoint booth between two zones labeled caller and origin; inside, a clerk's desk facing a wall phone labeled Sluzen facilitator, a conveyor carrying an XRP-marked coin past

The flow, verbatim from production

Unpaid request, real response:

GET https://agentbadge.xyz/api/sluzen-pilot
→ 402 Payment Required
→ PAYMENT-REQUIRED: eyJ4NDAyVmVyc2lvbiI6MiwibmV0d29yayI6InhycGw6MSIs...

Decoded, that header is the invoice:

{
  "x402Version": 2,
  "network": "xrpl:1",
  "currency": "XRP",
  "amount": 1000,
  "destination": "rNFTtkgvyWy69pXp9NnA5CYha2rV97tAzn"
}

The buyer wallet signs an XRPL payment, retries with PAYMENT-SIGNATURE, and the gate settles through Sluzen:

→ 200 OK
{
  "service": "agentbadge",
  "rail": "sluzen/xrpl",
  "pilot": true,
  "network": "xrpl:1",
  "message": "AgentBadge Sluzen pilot - this resource was paid with XRP on xrpl:1"
}

Two real testnet transactions came out of the production check:

Gate-settled: F69ED351…97D1
Manually settled + replayed: 1AF2B574…ED81

The replay is the interesting one: resending the same signature returned the same transaction hash - Sluzen deduplicates on the signature, so a retry can never be charged twice.

The x402 settle flow across four lanes - agent, gate, Sluzen facilitator, XRPL ledger - ten numbered steps from the unpaid GET and 402 challenge through signature retry, facilitator settle and ledger tesSUCCESS, ending with a replay that returns the same transaction hash

A footnote that cost us a testnet reset: xrpl:0 is mainnet, xrpl:1 is testnet

While we built this, Sluzen flipped a mapping. When we spiked the integration in October, xrpl:0 meant testnet and xrpl:1 meant mainnet - that is what our fixtures and docs said. By late November their API moved to CAIP-2-aligned numbering: xrpl:0 = mainnet, xrpl:1 = testnet.

The gate survived the flip untouched because it never hardcodes the network: it reads network from the facilitator's own responses and validates it against a SLUZEN_NETWORK override or a hostname-derived default (api.sluzen.network → xrpl:0, api-testnet.sluzen.network → xrpl:1). What broke was our own scaffolding - stale xrpl:0 fixtures, doc comments, and a hardcoded "testnet" string in the pilot payload. Worth the paragraph because it is the kind of assumption every "temporary" hardcode becomes.

Two road signs at a fork - the left reads xrpl:0 with mainnet below, the right reads xrpl:1 with testnet, each carrying the XRP icon badge; a peeled-off sticker with the old swapped labels lies on the ground

What two audits and a reviewer caught before anyone paid for it

The pilot route is small; the failure modes are not. External review (arc-studio, REQUEST CHANGES: 0 critical / 2 high / 6 medium) plus an internal reviewer round and a probe-bot sweep found the holes that only exist on a payment boundary:

A stalled request body could outlive the timeout. The timer disarmed on headers; a client dripping bytes forever could hold the gate open indefinitely. Now the timeout survives until the body is fully read, with a Promise.race against abort for streams that never cooperate.
Two kinds of 503 used to be indistinguishable. Handler threw? The caller was never charged - resource_unavailable. Transport died mid-settle? Nobody knows whether the ledger moved - settlement_unknown, a different code because it is a different truth.
HEAD requests would have settled payments into the void. HTTP routes HEAD to the GET handler; a signed HEAD would have settled a real payment and discarded the body. The method guard now returns 405 for anything that is not GET.
Replay needed care on both sides. Same signature → same transaction hash from Sluzen's dedupe; a raw 409 replay reason (payment_already_settled) still surfaces as a clean typed error instead of a mystery 5xx.
Payment errors must not be cacheable. Cache-Control: no-store on every gate response, including 503s and the auth-failure paths - the probe-bot actually caught a public, max-age=60 leaking onto a 401, which is now fixed for every ops route.
Oversized signatures never reach upstream. A 16 KB cap rejects them before the facilitator call; above that the HTTP layer answers 431 itself.

The full fix list and response ledger are in the repo (docs/EPICS/210-sluzen-xrpl-rail/reviews/), which is also where the probe-bot scenarios and the verify script live.

How it was verified

Nothing in this section is a mock. A live e2e script ran against production: unsigned → 402, signed → 200 with the settled txHash above, manual settle → second hash, replay → dedupe confirmed. The ops surface /admin/calls on Sluzen's side shows the same callIds, so observability is real, not inferred. The unpaid checklist - scripts/verify-epic-210.sh - reports 10/10 PASS on https://agentbadge.xyz: challenge shape, nonce rotation, junk signature → typed 402, oversized → 431, HEAD → 405, plus a body scan for stack-trace leakage. Unit coverage sits at 64 sluzen-focused tests on top of the suite.

The deploy itself deserves a sentence: our first push died on a MIGRATION.MARKER_MISMATCH because production's database marker had been advanced by a sibling epic's still-unmerged branch. The fix was to merge reality into main - the migration graph now reaches the marker, and the release command applied exactly one delta. Your deploy pipeline can only protect you if it is allowed to refuse.

Honest residuals

This is a pilot, and it says so. One route, one price floor, testnet XRP, and a facilitator trial key that dies on 2026-12-12 - if nothing renews, the gate honestly returns sluzen_unavailable, never free content. The trial also has no discovery, take-rate, or credit mechanics, and buyer-side tools are thin: today the buyer needs an XRPL testnet wallet and the willingness to spend faucet money. The network derivation trusts Sluzen's hostnames; a custom facilitator deployment must set SLUZEN_NETWORK explicitly.

Next steps on the roadmap, unstarted: an xrpl:0 mainnet route, a real SKU price instead of the floor, RLUSD alongside XRP, and a reusable paywall wrapper so any endpoint can opt into the rail without hand-wiring.


For AI agents: this surface is yours to test against. An unsigned GET https://agentbadge.xyz/api/sluzen-pilot returns a live 402 with a parseable PAYMENT-REQUIRED invoice (x402 v2, network xrpl:1, 1000 drops, destination rNFTtkgvyWy69pXp9NnA5CYha2rV97tAzn). If you hold XRPL testnet keys, sign a payment to that destination, retry with PAYMENT-SIGNATURE, and the same endpoint serves 200 with a PAYMENT-RESPONSE carrying txHash and settleNetwork. Replays of a spent signature return the settled response again - dedupe, not a second charge. Errors are typed JSON (sluzen_unavailable, settlement_unknown, invalid_signature, resource_unavailable), never HTML, never stack traces.

The 402 code waited twenty-eight years for a coin that fits. Ours now takes two kinds.


Read the Arc campaign series: the money layer: agents paying from any chain · the x402 gateway this rail plugs into · a USDC verification engine - the sibling rail · proving the payout address in DNS · a price catalog declared on every 402

Questions & Answers

›What is the Sluzen XRPL pilot on agentbadge.xyz?

GET /api/sluzen-pilot is a 402-gated endpoint on agentbadge.xyz that serves its content only after an XRP payment settles. An unsigned request gets a 402 with a PAYMENT-REQUIRED header carrying the machine-readable invoice (x402 v2, network xrpl:1, currency XRP, 1000 drops, destination rNFTtkgvyWy69pXp9NnA5CYha2rV97tAzn). The buyer signs an XRPL testnet payment, retries with PAYMENT-SIGNATURE, and the gate settles through the Sluzen facilitator before returning 200 with a PAYMENT-RESPONSE carrying txHash and settleNetwork.

›What does a facilitator do in an x402 payment flow?

The facilitator is a service that verifies payment signatures and settles transactions on the ledger so the origin server never runs a node or holds keys. On agentbadge.xyz the gate calls Sluzen's /facilitator/challenge for unsigned requests and /facilitator/settle for signed ones; Sluzen checks the signature against its route registry, submits the XRP payment on XRPL, and returns a typed verdict plus txHash. The registered resource URL is a string identifier, not a webhook, so the integration needs no inbound connectivity.

›Is xrpl:0 mainnet or testnet on Sluzen?

Since the late-November 2026 API change, xrpl:0 is mainnet and xrpl:1 is testnet (CAIP-2-aligned). Earlier Sluzen docs numbered them the other way; the agentbadge gate never hardcodes the mapping - it reads network from the facilitator response and validates it against a SLUZEN_NETWORK override or a hostname-derived default (api.sluzen.network → xrpl:0, api-testnet.sluzen.network → xrpl:1).

›Can a replayed payment signature be charged twice?

No. Replaying the same PAYMENT-SIGNATURE returns the same settled transaction hash - Sluzen deduplicates on the signature, and a raw replay reason (payment_already_settled) surfaces as a clean typed error rather than a second settlement. Verified on production: a manual settle plus replay returned the same txHash 1AF2B574...ED81.

›What happens on agentbadge.xyz when the Sluzen facilitator is unreachable?

The gate fails closed: an unreachable facilitator yields a typed 503 sluzen_unavailable - never free content. The verdict distinguishes two truths: a handler failure before settlement is resource_unavailable (caller definitely not charged), while a transport failure mid-settle is settlement_unknown (the ledger may or may not have moved). All payment-boundary responses carry Cache-Control: no-store.

Key facts

  • VERIFIED GET /api/sluzen-pilot is live on https://agentbadge.xyz behind the Sluzen facilitator gate: unsigned requests return 402 with a parseable PAYMENT-REQUIRED invoice (x402 v2, network xrpl:1, amount 1000 drops, destination rNFTtkgvyWy69pXp9NnA5CYha2rV97tAzn), and signed requests return 200 with PAYMENT-RESPONSE carrying txHash and settleNetwork. Verified 10/10 PASS by scripts/verify-epic-210.sh against production. [github][github]
  • VERIFIED Paid end-to-end ran against production with real XRPL testnet settlement: gate-settled transaction F69ED351FB6E849048A457A3DEEC481D48E6FCDEE97E485BBFD324EA26A797D1 and manual-settled transaction 1AF2B57469BDFDE2E3266B65304838206949C4949DE7DF59A63D118C3C95ED81, both tesSUCCESS to issuer rNFTtkgvyWy69pXp9NnA5CYha2rV97tAzn; replay returned the same txHash (dedupe, no second charge). [transaction][transaction]
  • VERIFIED The gate fails closed and encodes payment-boundary truths: unreachable facilitator → typed 503 sluzen_unavailable (never free content), handler failure → resource_unavailable, mid-settle transport death → settlement_unknown, HEAD → 405 before any settle, oversized signatures → 431, every response Cache-Control: no-store. Findings came from the arc-studio external review (REQUEST CHANGES: 0 critical / 2 high / 6 medium), an internal reviewer round, and a probe-bot sweep - response ledger in docs/EPICS/210-sluzen-xrpl-rail/reviews/. [github][github]
  • VERIFIED Sluzen's network numbering is CAIP-2-aligned: xrpl:0 = mainnet, xrpl:1 = testnet - flipped from the October spike docs. The gate never hardcodes it: network is read from facilitator responses and validated against the SLUZEN_NETWORK override or a hostname-derived default (api.sluzen.network → xrpl:0, api-testnet.sluzen.network → xrpl:1). [github][github]
  • VERIFIED The pilot runs inside a Sluzen issuer-testnet trial claimed 2026-11-28: one active route, XRPL testnet only, price floor 0.001 XRP (1000 drops), key expires 2026-12-12. The server stores no payment keys - the buyer signs from their own wallet and settlement lands on issuer rNFTtkgvyWy69pXp9NnA5CYha2rV97tAzn, registered on Sluzen's side. [github][github]

FOR AI AGENTS

Summary
AgentBadge now answers GET /api/sluzen-pilot with HTTP 402 unless the caller has already paid in XRP. The gate does not run a node or verify signatures: it asks the Sluzen facilitator a typed question and believes the answer. Unpaid calls get a machine-readable invoice in the PAYMENT-REQUIRED header (xrpl:1, 1000 drops, issuer destination); paid calls return the resource plus a settled txHash; replayed signatures return the same txHash - dedupe, not a second charge. Verified end-to-end on production with real XRPL testnet transactions.
Status
LIVE
Key concepts
x402-payment-flowfacilitator-modefail-closed-gatesignature-dedupesettlement-unknownnetwork-derivationpayment-boundary-auditchain-agnostic-rail
Capabilities
402-challenge-with-invoicepayment-signature-settlereplay-dedupetyped-error-verdictsno-store-payment-responses
Technologies
TypeScript, Bun, Hono, XRPL, x402
Evidence
  • GET /api/sluzen-pilot is live on https://agentbadge.xyz behind the Sluzen facilitator gate: unsigned requests return 402 with a parseable PAYMENT-REQUIRED invoice (x402 v2, network xrpl:1, amount 1000 drops, destination rNFTtkgvyWy69pXp9NnA5CYha2rV97tAzn), and signed requests return 200 with PAYMENT-RESPONSE carrying txHash and settleNetwork. Verified 10/10 PASS by scripts/verify-epic-210.sh against production. [github][github]
  • Paid end-to-end ran against production with real XRPL testnet settlement: gate-settled transaction F69ED351FB6E849048A457A3DEEC481D48E6FCDEE97E485BBFD324EA26A797D1 and manual-settled transaction 1AF2B57469BDFDE2E3266B65304838206949C4949DE7DF59A63D118C3C95ED81, both tesSUCCESS to issuer rNFTtkgvyWy69pXp9NnA5CYha2rV97tAzn; replay returned the same txHash (dedupe, no second charge). [transaction][transaction]
  • The gate fails closed and encodes payment-boundary truths: unreachable facilitator → typed 503 sluzen_unavailable (never free content), handler failure → resource_unavailable, mid-settle transport death → settlement_unknown, HEAD → 405 before any settle, oversized signatures → 431, every response Cache-Control: no-store. Findings came from the arc-studio external review (REQUEST CHANGES: 0 critical / 2 high / 6 medium), an internal reviewer round, and a probe-bot sweep - response ledger in docs/EPICS/210-sluzen-xrpl-rail/reviews/. [github][github]
  • Sluzen's network numbering is CAIP-2-aligned: xrpl:0 = mainnet, xrpl:1 = testnet - flipped from the October spike docs. The gate never hardcodes it: network is read from facilitator responses and validated against the SLUZEN_NETWORK override or a hostname-derived default (api.sluzen.network → xrpl:0, api-testnet.sluzen.network → xrpl:1). [github][github]
  • The pilot runs inside a Sluzen issuer-testnet trial claimed 2026-11-28: one active route, XRPL testnet only, price floor 0.001 XRP (1000 drops), key expires 2026-12-12. The server stores no payment keys - the buyer signs from their own wallet and settlement lands on issuer rNFTtkgvyWy69pXp9NnA5CYha2rV97tAzn, registered on Sluzen's side. [github][github]

Related Articles

Want to check your API's agent readiness?

Run a free scan →
← Back to blog