x402 · Stellar testnet

x402 payments on Stellar that charge only for what's used.

Periplo is an open-source, non-custodial x402 facilitator: in x402, the facilitator is the service that verifies and sends the payment the buyer signs. With upto, the buyer signs a spending ceiling once and only the real usage settles; the contract enforces the ceiling and its balance is zero after every settlement.

We're proposing upto for Stellar inside the x402 standard, so any facilitator can use it the same way (open PR, x402-foundation/x402#3098)

Testnet only. Periplo does not operate on mainnet yet.

01

How it works

A service answers HTTP 402 with its price. The buyer signs a payment; Periplo checks it and submits it to Stellar. Two schemes cover two ways of charging.

exact: a fixed price

  1. The service asks for a fixed amount.
  2. The buyer signs exactly that amount.
  3. Periplo verifies it and settles that same amount.

For requests with a known price, like one API call at a flat rate.

upto: pay for real usage

  1. The buyer signs a spending ceiling once.
  2. The service measures what was actually used.
  3. Only the real amount is settled; the contract refunds the rest in the same transaction.

For usage you only know afterwards: tokens generated, seconds of access, rows returned.

Who controls the funds

The buyer signs each payment with their own key. The facilitator only pays network fees, refuses to start with a key that can move user funds, and is never the source or signer of a buyer's payment.

Read the threat model

Discovery included

Resources settled through Periplo can be cataloged so agents can find them by searching, not by knowing the URL in advance.

Where upto runs today

upto settles against the UptoSettlement contract on testnet. The public facilitator only advertises the schemes listed in its live status below.

02

Evidence on testnet

Real stellar:testnet transactions, each one linked to the block explorer so you can check it yourself.

  • exactstellar:testnet

    Periplo's first full pipeline: a payment signed with @x402/stellar, verified and settled by Periplo's facilitator core.

    View transaction: 83d2aa3b60…d89f33
  • uptostellar:testnet

    Partial settlement: the buyer signed a 0.1 PTEST ceiling and the facilitator settled 0.04 PTEST.

    View transaction: cc46374e34…c5d218
  • uptostellar:testnet

    Zero settlement: a 0.05 PTEST ceiling settled at 0, the full ceiling returned to the buyer; a replay with the same nonce was rejected.

    View transaction: 2138c0418a…03d358
  • exactstellar:testnet

    Periplo's first payment between an external seller and an independent buyer, neither of them this project, in testnet USDC.

    View transaction: 4befe51d2c…7904fd
  • exactstellar:testnet

    Interoperability: a payment built with the same client code, verified and settled through x402.org's independent reference facilitator.

    View transaction: 43bd169873…dc7c8f
  • exactstellar:testnet

    Four concurrent settlements in the same ledger, each from a different account of the channel-account pool.

    View transaction: 33a6791890…0b3764
  • uptostellar:testnet

    Metered API: a 0.1 PTEST ceiling for up to 20 rows; 10 rows were returned, so 0.05 PTEST was settled and the rest refunded.

    View transaction: cf33b51350…533823
  • uptostellar:testnet

    The same contract, in testnet USDC: a 0.10 USDC ceiling and 0.05 USDC settled, the rest refunded. The asset travels inside each signed authorization, so the contract was not redeployed.

    View transaction: d554adfb8f…c5cafb
All recorded results (conformance/RESULTS.md)

06

Client library

periplo is the npm package behind these examples: sign an upto ceiling as a buyer, or advertise one and settle real usage as a seller.

npm i periplo
import { createUptoStellarPayer, payAndFetch } from "periplo";

const payer = createUptoStellarPayer(buyerSecret, "stellar:testnet", {
  facilitatorBaseUrl: "https://periplo-testnet.fly.dev",
  maxSpendPerAuthorization: 1_000_000n, // 0.1 USDC, 7 decimals
});

const response = await payAndFetch(resourceUrl, payer);

03

Facilitator live status

Read from the public deployment's /supported and /status endpoints when you open this page. periplo-testnet.fly.dev

Contacting the facilitator…

04

Upstream contributions

Bugs Periplo found and fixes it proposed in the libraries it builds on. The state of each one comes from the GitHub API, not from memory.

State checked against the GitHub API on .

Merged: 3Closed as resolved: 10Open: 10Closed without merge: 1Closed as not planned: 1

Issues (16)

Show 11 more

05

Open source

All of Periplo is public under Apache-2.0: the facilitator, the discovery catalog, the contracts and this site.