Skip to Content
KryptWarden Developers
REST APIs

Facilitator & relayer

x402 verify and settle for sellers, plus fee-sponsored hold and rejection calls for agents.

Base URL: https://pay.kryptwarden.xyz

One service does two jobs, from one funded Stellar account (GAB2H5E5MOU2GTD73HD24WF2OETJVPUJG7AVXQPF2TYOCUAU6NXD6R6W):

  • Facilitator: the standard x402 v2 endpoints a seller's middleware calls. It uses @x402/stellar unmodified, with a fee ceiling high enough for custom-account payments (2,000,000 stroops).
  • Relayer: submits agent-signed hold requests and rejection records, and pays their fees, so the agent needs no XLM.

Submissions go through one queue, so they're processed one at a time.

x402 facilitator

You normally don't call these yourself; @x402/express and similar middleware do. See Sell over x402.

GET /supported

The payment kinds this facilitator settles: x402 version 2, scheme exact, network stellar:testnet, with fees sponsored by the facilitator.

POST /verify

{ "paymentPayload": { "...": "x402 PaymentPayload" }, "paymentRequirements": { "...": "x402 PaymentRequirements" } }

Returns the x402 verify result. On an exception: 400 { "isValid": false, "invalidReason": "verify_exception", "invalidMessage": "…" }.

POST /settle

Same body as /verify. Submits the transfer and returns the x402 settle result, including the transaction hash. On an exception: 400 { "success": false, "network": "stellar:testnet", "transaction": "", "errorReason": "settle_exception", "errorMessage": "…" }.

Agent relayer

Both endpoints take a signed agent intent. The SDK builds it with buildSignedAgentIntent(); you only need these details if you're writing your own client.

interface SignedAgentIntent {
  domain: "KW_HOLD1" | "KW_REJ1";
  walletAddress: string;   // C…
  agentPublicKey: string;  // G…
  agentKeyHex: string;     // 64 hex chars
  sellerAddress: string;   // G… or C…
  amountStroops: string;   // positive integer
  reasonCode: number;      // 0 for holds; contract error code for rejections
  requestIdHex: string;    // 64 hex chars, unique
  maxLedger: number;       // last ledger the intent is valid for
  signatureHex: string;    // 128 hex chars, ed25519
}

The signature covers the SHA-256 of the contract's SignedAgentIntent XDR, which includes the network ID and wallet address. See Security model.

Before submitting, the relayer validates the body, rate-limits the agent (default 8 requests per minute), verifies the signature locally, and simulates the transaction.

POST /relayer/hold

Body: an intent with domain: "KW_HOLD1". Calls request_hold on the wallet.

{ "holdId": 7, "expiresAt": 1796127600, "txHash": "a1b2…" }
StatusMeaning
201Hold created
400Malformed body, or wrong domain
401Signature doesn't verify
422The contract refused it, e.g. SellerNotAllowed or BudgetExceeded; error has the message
429Too many requests from this agent

POST /relayer/rejection

Body: an intent with domain: "KW_REJ1" and reasonCode set to the contract error that applied. Calls record_rejected_attempt, which moves no money and emits a PaymentRejected event.

{ "recorded": true, "txHash": "c3d4…" }

Same status codes as /relayer/hold.

GET /health

{
  "service": "kryptwarden-facilitator-and-relayer",
  "status": "healthy",
  "network": "stellar:testnet",
  "facilitatorAddress": "GAB2H5E5MOU2GTD73HD24WF2OETJVPUJG7AVXQPF2TYOCUAU6NXD6R6W",
  "maxTransactionFeeStroops": 2000000,
  "sponsoredStroopsToday": 1234567
}

On this page