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

@aeoess/stripe-governance

v0.1.0

Published

APS governance layer for Stripe agent payments — commerce delegation, spend limits, merchant allowlists, audit trail

Downloads

69

Readme

APS Governance Adapter for Stripe Agent Payments

The authorization layer between your agent and Stripe.

Stripe handles money movement. APS handles who authorized it, within what limits, and produces the audit trail. Neither replaces the other.

The Problem

Stripe's Agent Toolkit gives agents access to payment tools. Stripe's Restricted API Keys (RAKs) control which Stripe APIs the agent can call. But RAKs don't answer:

  • Who authorized this specific agent to make this specific purchase?
  • What's the spending ceiling for this task, not just this API key?
  • Which merchants is this agent allowed to transact with?
  • Does a human need to approve transactions above a threshold?
  • Can we trace this payment back to the human principal who delegated authority?

APS commerce delegation answers all five.

How It Works

Agent wants to pay for API credits
       │
       ▼
┌─────────────────────────┐
│  APS 4-Gate Preflight   │
│                         │
│  1. Passport valid?     │  ← Agent identity (Ed25519)
│  2. Scope authorized?   │  ← Delegation includes commerce
│  3. Budget remaining?   │  ← Spend tracking per delegation
│  4. Merchant allowed?   │  ← Allowlist check
│                         │
│  All gates pass? ──────►│──── Stripe processes payment
│  Any gate fails? ──────►│──── Payment blocked, receipt emitted
└─────────────────────────┘
       │
       ▼
  Signed ActionReceipt
  (links payment → delegation → human principal)

Works With

  • Stripe Agent Toolkit — wraps LangChain/CrewAI/Vercel AI SDK tools
  • Stripe MPP (Machine Payments Protocol) — governs agent-to-service payments
  • Stripe x402 — governs USDC micropayments on Base
  • Stripe SPTs (Shared Payment Tokens) — governs agentic network tokens

Quick Start

npm install @aeoess/stripe-governance agent-passport-system
import { governMPPPayment } from '@aeoess/stripe-governance'
import { createPassport, createCommerceDelegation } from 'agent-passport-system'

// Human principal sets up agent with commerce authority
const delegation = createCommerceDelegation({
  delegatorKeys: humanKeys,
  agentPublicKey: agentKeys.publicKey,
  spendLimit: 50000,                    // $500.00
  currency: 'usd',
  allowedMerchants: ['api.openai.com'], // only approved vendors
  requireHumanApproval: true,
  humanApprovalThreshold: 10000,        // human approves above $100
})

// Agent receives MPP payment request from a service
const result = await governMPPPayment(config, {
  amount: 4999,
  currency: 'usd',
  merchant: 'api.openai.com',
  resource: 'GPT-4 API credits',
  paymentMethod: 'spt',
})

// result.authorized === true
// result.receipt links this payment to the delegation chain
// result.remainingBudget === 45001 ($450.01)

Integration with Stripe Agent Toolkit

import { createStripeAgentToolkit } from '@stripe/agent-toolkit/langchain'
import { governStripeTools } from '@aeoess/stripe-governance'

// Standard Stripe setup
const toolkit = await createStripeAgentToolkit({
  secretKey: process.env.STRIPE_SECRET_KEY
})

// Wrap with APS governance
const governedTools = governStripeTools(toolkit.getTools(), {
  passport: agentPassport,
  delegation: commerceDelegation,
  onHumanApprovalRequired: async (request) => {
    // Send Slack notification, wait for human response
    return await notifyHumanViaSlack(request)
  },
  onReceipt: (receipt) => {
    // Log to your audit system
    await auditLogger.log(receipt)
  },
})

// Use governedTools with your LangChain agent
// Every payment tool call goes through APS preflight first

Financial Observability

import { getAgentBudgetStatus } from '@aeoess/stripe-governance'

const status = getAgentBudgetStatus(config)
// {
//   agentId: 'agent-procurement-abc123',
//   spendLimit: 500.00,
//   spentAmount: 249.99,
//   remainingBudget: 250.01,
//   utilizationPercent: 49.99,
//   humanApprovalThreshold: 100.00,
//   approvedMerchants: ['api.openai.com', 'vercel.com']
// }

Run the Demo

npx tsx examples/stripe-governance/demo.ts

Shows four scenarios: auto-approved payment, human-approval-required payment, unauthorized merchant (blocked), and budget exhaustion (blocked).

Architecture

APS provides the authorization layer. Stripe provides the settlement layer.

| Concern | Who Handles It | |---------|---------------| | Agent identity | APS (Ed25519 passport) | | Spend authorization | APS (commerce delegation) | | Merchant allowlisting | APS (delegation scope) | | Human escalation | APS (approval threshold) | | Audit trail | APS (signed receipts) | | Money movement | Stripe (MPP/SPT/x402) | | Payment processing | Stripe (PaymentIntents API) | | Fraud detection | Stripe (Radar) | | Tax calculation | Stripe (Tax) |

License

Apache-2.0. Part of the Agent Passport System.