On-chain spending limits for AI agents that pay for API calls.
An owner deploys a contract that holds the money and sets the rules. The agent gets a key that can ask the contract to pay, and the contract refuses anything outside those rules before any tokens move.
Unaudited, and built for testnet. Do not put mainnet funds behind it.
stellar-allowance.vercel.app runs a full payment on testnet in about a minute and needs no wallet. It funds an owner, deploys an allowance, pays a live x402 API, and shows two payments refused on chain.
Create one at the dashboard with Freighter. It hands you two values, which are all the agent needs.
npm i @stellar-allowance/sdkimport { Allowance } from '@stellar-allowance/sdk';
const { fetch } = new Allowance();
const response = await fetch('https://api.example.com/paid');STELLAR_ALLOWANCE_ID=C... which allowance pays
STELLAR_ALLOWANCE_SECRET=S... proof it may ask
fetch is the ordinary fetch with a 402 handled in the middle. Same arguments, same Response
back, and a URL that never asks for payment passes straight through.
Two flows, one contract between them. The owner creates an allowance and can change its rules, top it up, empty it or pause it. The agent can request a payment and nothing else: it cannot change a rule, pay anyone off the list, or take money out.
contracts/allowance |
the Soroban contract, and the design: __check_auth, the allowlist, the rolling window, storage and TTL |
sdk |
@stellar-allowance/sdk |
web |
the site and the dashboard |
demo/seller |
a live x402 API for the demo to pay |
docs |
why each decision was made, dated, including the ones that turned out wrong |
Apache 2.0. Built by synacktraa.