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

> Published: 2026-11-29 | Author: AgentBadge Team | Canonical: https://agentbadge.xyz/blog/arc-c70-sluzen-xrpl

## 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](https://agentbadge.xyz/blog/arc-c68-process-mapping) (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](https://agentbadge.xyz/blog/arc-c50-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](/images/blog/arc-c70-sluzen-xrpl-i2.webp)

## 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&hellip;97D1](https://testnet.xrpl.org/transactions/F69ED351FB6E849048A457A3DEEC481D48E6FCDEE97E485BBFD324EA26A797D1)

[Manually settled + replayed: 1AF2B574&hellip;ED81](https://testnet.xrpl.org/transactions/1AF2B57469BDFDE2E3266B65304838206949C4949DE7DF59A63D118C3C95ED81)

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](/images/blog/arc-c70-sluzen-xrpl-d1.webp)

## 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](/images/blog/arc-c70-sluzen-xrpl-i3.webp)

## 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](https://agentbadge.xyz/blog/arc-c3-money-layer) ·
[the x402 gateway this rail plugs into](https://agentbadge.xyz/blog/arc-c50-x402-gateway) ·
[a USDC verification engine - the sibling rail](https://agentbadge.xyz/blog/arc-c48-direct-usdc-engine) ·
[proving the payout address in DNS](https://agentbadge.xyz/blog/arc-c63-payto-proof) ·
[a price catalog declared on every 402](https://agentbadge.xyz/blog/arc-c15-x402-bazaar)

---

## For AI Agents

- Companion guide: https://agentbadge.xyz/agent-guide/articles/arc-c70-sluzen-xrpl
- Knowledge Index: https://agentbadge.xyz/agent-guide/
- LLM entry point: https://agentbadge.xyz/llms.txt
- Engineering services: https://agentbadge.xyz/agent-guide/team/services
