Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.delegare.dev/llms.txt

Use this file to discover all available pages before exploring further.

The fastest way to understand Delegare is to run our end-to-end example. You will act as both the Merchant (setting up a server) and the User (authorizing a spending mandate).
Prerequisites: You need Node >=22 and pnpm >=9 installed on your machine.

1. Get Sandbox Credentials

  1. Go to the Delegare Sandbox Dashboard.
  2. Register a new test merchant account.
  3. Copy your merchantId and testApiKey.

2. Clone the Example App

We have provided an Express server that acts as a mock merchant (e.g., a pizza shop or API service).
git clone https://github.com/delegare/delegare.git
cd delegare/examples/express-checkout
pnpm install

3. Configure the Environment

Create an environment file:
cp .env.example .env
Open .env and paste your sandbox credentials:
DELEGARE_BASE_URL=https://api.sandbox.delegare.dev/v1
DELEGARE_MERCHANT_ID="your_merchant_id"
DELEGARE_API_KEY="your_test_api_key"

# Optional: Set this to your USDC wallet address if you want to test x402 auto-payments
# MERCHANT_USDC_WALLET="0x..."

4. Run the Merchant Server

Start your mock merchant backend:
pnpm dev
(Leave this running in the terminal)

5. Generate a Buyer Mandate

Open a new terminal tab in the same directory. We will now run a script that simulates a user approving a budget for an AI agent.
pnpm setup
  1. The script will generate a Setup URL. Click the link to open it in your browser.
  2. In the Sandbox UI, authorize a $50/month limit for this agent. You can use Stripe test cards.
  3. Once approved, return to your terminal. The script will print out a long string starting with eyJhbGci... - this is your Intent Mandate.

6. Execute an Agent Charge

Now, pretend you are the AI agent who holds this mandate and wants to buy something from the merchant. Run this curl command, replacing the intentMandate with your token:
curl -X POST http://localhost:4000/api/checkout \
  -H "Content-Type: application/json" \
  -d '{
    "intentMandate": "eyJhbGciOiJFU...",
    "item": "large_pepperoni_pizza",
    "deliveryAddress": "123 AI Avenue"
  }'

7. View the Result

Look at your first terminal (the merchant server). You should see logs indicating that the Delegare SDK successfully executed the charge against the agent’s limit. Congratulations! You just processed an agent-authorized payment without sharing any credit card details.

Next Steps

  • Learn how to integrate the Typescript SDK into your own backend.
  • Read about our Security Model to see how limits are enforced.
  • Add payment capabilities to Claude Desktop with our MCP Tools.