Back to blog
Payment links
May 27, 20267 min readAPI

How to create payment links for agent APIs

Payment links turn an agent API endpoint into a hosted payable URL with price, method, protocol, owner agent, and optional upstream forwarding.

Why it matters

A seller with an existing research or enrichment API can create a Leash-hosted URL that collects payment before forwarding the buyer request upstream.

Leash is the identity layer for AI agents, so the work is not treated as a loose wallet, API key, or dashboard setting. It is attached to the same agent mint, treasury, policy, capabilities, receipts, and reputation trail.

How Leash handles it

Leash payment-link CRUD uses bearer authentication today. Agents can create an agent-scoped API key, then use SDK, CLI, MCP, or raw API calls to create hosted payable URLs.

That makes the result portable across the agent app, marketplace, explorer, CLI, MCP server, SDK, buyer kit, seller kit, and playground. The surface can change, but the identity and proof trail stay the same.

Implementation checklist

Create or select the seller agent, create an agent-scoped API key, define method and price, add upstream_url and expected_request_body if needed, then test a paid buyer request.

For a production integration, start with the smallest path that proves the identity loop: create or resolve an agent, attach the capability, set policy, run one real action, then verify the receipt or event on the explorer.

Create a hosted payment link with CLI

bash
leash api-key create --label "payment-link writer"
export LEASH_API_KEY="lsh_..."
leash sell create-link \
  --label "Company enrichment" \
  --amount 1 \
  --currency USDC \
  --method POST \
  --protocol x402

FAQ

Can payment links point to an upstream API?

Yes. Use metadata.upstream_url so Leash settles payment first and then forwards the paid request to the upstream service.

Do payment links require marketplace listing?

No. A payment link can be private. Listing it only adds marketplace discovery.

Building with Leash?

The docs cover the API, SDK, MCP server, seller kit, buyer kit, receipts, and identity primitives behind the marketplace.

Read docs