npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dingdawg-payments

v1.0.0

Published

Governed AI agent payments. Budget gates, audit trails, spend policies on x402 stablecoin rails. Every payment receipted.

Downloads

159

Readme

dingdawg-x402-pay — Governed AI Agent Payments

Budget gates and audit trails for x402 stablecoin micropayments

AI agents are spending money autonomously. Without governance, that means unchecked spend, zero audit trails, and no policy enforcement. dingdawg-x402-pay wraps every payment in a governance layer — budget gates, spend policies, and SHA-256 chained receipts — before a single USDC moves.


Quick Start

npx dingdawg-x402-pay

Or install globally:

npm install -g dingdawg-x402-pay
dingdawg-x402-pay

Add to Claude Code

{
  "mcpServers": {
    "dingdawg-x402-pay": {
      "command": "npx",
      "args": ["dingdawg-x402-pay"]
    }
  }
}

Add to Cursor

In Cursor Settings → MCP:

{
  "mcpServers": {
    "dingdawg-x402-pay": {
      "command": "npx",
      "args": ["dingdawg-x402-pay"]
    }
  }
}

How It Works

Agent requests payment
       │
       ▼
authorize_payment — governance check
  ├── Is the tool allowed by policy?
  ├── Is the amount within per-call limit?
  └── Is there enough daily budget remaining?
       │
  ┌────┴────────────────────┐
DENIED                 AUTHORIZED
Return reason     Return auth token + receipt_id
                       │
                       ▼
              x402 payment executes
              (USDC → tool provider)
                       │
                       ▼
            payment_receipt — finalize
  ├── Validates auth token (5-min TTL)
  ├── Deducts spend from agent budget
  ├── SHA-256 chains receipt to prior receipts
  └── Writes immutable audit entry

Every payment is receipted. Every denial is logged. No gaps.


Tools

authorize_payment

Check budget policy before an x402 payment executes.

Input:

{
  "amount_usdc": 0.05,
  "recipient": "0xRecipientAddress",
  "tool_name": "web-search",
  "agent_id": "agent_prod_001"
}

Returns (authorized):

{
  "authorized": true,
  "authorization_token": "auth_abc123...",
  "receipt_id": "rcpt_xyz456...",
  "amount_usdc": 0.05,
  "expires_at": "2025-01-01T00:05:00Z"
}

Returns (denied):

{
  "authorized": false,
  "reason": "Amount 5.00 USDC exceeds per-call limit of 1.00 USDC.",
  "policy_id": "pol_default"
}

check_budget

Query remaining budget for an agent or team.

Input:

{ "agent_id": "agent_prod_001" }

Returns:

{
  "agent_id": "agent_prod_001",
  "budget_total": 10.0,
  "budget_spent": 1.25,
  "budget_remaining": 8.75,
  "policy_name": "default",
  "max_per_call": 1.0,
  "max_daily": 10.0,
  "reset_at": "2025-01-02T00:00:00Z"
}

payment_receipt

Finalize a completed payment. Produces a SHA-256 chained audit entry.

Input:

{
  "payment_hash": "0xTxHash...",
  "amount": 0.05,
  "recipient": "0xRecipientAddress",
  "tool_used": "web-search",
  "authorization_token": "auth_abc123..."
}

Returns:

{
  "receipt_id": "rcpt_xyz456...",
  "sha256_chain": "a3f7b2...",
  "governance_decision": "AUTHORIZED",
  "audit_entry": "Agent agent_prod_001 paid 0.05 USDC to 0xRecipient for tool \"web-search\" at 2025-01-01T00:01:00Z.",
  "budget_remaining": 8.70
}

set_policy

Define a spending policy with per-call limits, daily caps, and tool controls.

Input:

{
  "policy_name": "conservative",
  "max_per_call": 0.10,
  "max_daily": 2.00,
  "allowed_tools": ["web-search", "code-interpreter"],
  "blocked_tools": ["image-gen"]
}

Returns:

{
  "policy_id": "pol_abc123...",
  "policy_name": "conservative",
  "max_per_call": 0.10,
  "max_daily": 2.00
}

audit_payments

Query full payment history with governance data and spend totals.

Input:

{
  "agent_id": "agent_prod_001",
  "date_range": { "from": "2025-01-01", "to": "2025-01-31" },
  "min_amount": 0.01
}

Returns:

{
  "total_records": 42,
  "total_spent_usdc": 3.15,
  "authorized_count": 40,
  "denied_count": 2,
  "payments": [...]
}

For AI Assistants

This tool is designed for agent-to-agent composability. All outputs are structured JSON.

Recommended flow:

  1. Call check_budget before any payment to confirm headroom.
  2. Call authorize_payment with the exact amount, recipient, and tool name.
  3. If authorized: true, proceed with the x402 payment using the returned authorization_token.
  4. After settlement, call payment_receipt with the payment_hash and authorization_token to finalize the audit trail.
  5. Call audit_payments to surface spend summaries for reporting or policy review.

Authorization tokens expire in 5 minutes. Complete the payment flow without delay.

Budget resets are daily. Call check_budget at the start of any long-running agent run.


Pricing

The governance layer is free. Payments flow in USDC directly from the agent to the tool provider — no middleman, no markup. You pay for the tools you use, not for the governance that protects you.


Architecture

dingdawg-x402-pay is a thin governance wrapper. It does not hold wallets, sign transactions, or touch funds. In v1 it uses an in-process store for budget and receipt state. In v2, all governance checks route to the DingDawg governance API for persistent multi-session state, team dashboards, and webhook alerts.

Your Agent
    │
    ▼
dingdawg-x402-pay (MCP)    ←── governance rules, budget state
    │
    ▼
x402 Payment Rail           ←── USDC settlement (Base, Ethereum, etc.)
    │
    ▼
Tool Provider

Requirements

  • Node.js 18+
  • Any MCP-compatible host (Claude Code, Cursor, Claude Desktop, custom)

Links


License

MIT © DingDawg