{"_id":"@aeoess/stripe-governance","name":"@aeoess/stripe-governance","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@aeoess/stripe-governance","version":"0.1.0","description":"APS governance layer for Stripe agent payments — commerce delegation, spend limits, merchant allowlists, audit trail","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","test":"npx tsx --test tests/adapter.test.ts"},"license":"Apache-2.0","peerDependencies":{"agent-passport-system":">=1.34.0"},"devDependencies":{"agent-passport-system":"file:../../","tsx":"^4.7.0","typescript":"^5.3.3"},"keywords":["stripe","agent","governance","payments","x402","mpp","spt","ai-agent"],"repository":{"type":"git","url":"git+https://github.com/aeoess/agent-passport-system.git","directory":"packages/stripe-governance"},"gitHead":"d79af2ec285a9d63a78466b59b6ca248c2572224","_id":"@aeoess/stripe-governance@0.1.0","bugs":{"url":"https://github.com/aeoess/agent-passport-system/issues"},"homepage":"https://github.com/aeoess/agent-passport-system#readme","_nodeVersion":"24.11.1","_npmVersion":"11.6.2","dist":{"integrity":"sha512-jBbF1wKF7JEb/IFu8oLnImhMULyCgkJAGHMAKCHohxLV+nEdPjxEsBgiVen5o3vvAY+8RRvXjf5Gp75SUL2dPg==","shasum":"5a25a3910ff5ba813057b654673a10e2817d83c1","tarball":"https://registry.npmjs.org/@aeoess/stripe-governance/-/stripe-governance-0.1.0.tgz","fileCount":24,"unpackedSize":46216,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIALScyFCFJ4M9bVjrDuz7B2WALai5ZYXyQ7ewS3ltMsJAiEAtDF0GRy8EJbVH5JQx2ZwOtJmLuPHFruN9W2MPXkzvCc="}]},"_npmUser":{"name":"aeoess","email":"tima@aeoess.com"},"directories":{},"maintainers":[{"name":"aeoess","email":"tima@aeoess.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/stripe-governance_0.1.0_1775500768968_0.9022210236425043"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-06T18:39:28.876Z","0.1.0":"2026-04-06T18:39:29.120Z","modified":"2026-04-06T18:39:29.323Z"},"maintainers":[{"name":"aeoess","email":"tima@aeoess.com"}],"description":"APS governance layer for Stripe agent payments — commerce delegation, spend limits, merchant allowlists, audit trail","homepage":"https://github.com/aeoess/agent-passport-system#readme","keywords":["stripe","agent","governance","payments","x402","mpp","spt","ai-agent"],"repository":{"type":"git","url":"git+https://github.com/aeoess/agent-passport-system.git","directory":"packages/stripe-governance"},"bugs":{"url":"https://github.com/aeoess/agent-passport-system/issues"},"license":"Apache-2.0","readme":"# APS Governance Adapter for Stripe Agent Payments\n\n**The authorization layer between your agent and Stripe.**\n\nStripe handles money movement. APS handles who authorized it, within what limits, and produces the audit trail. Neither replaces the other.\n\n## The Problem\n\nStripe'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:\n\n- **Who authorized this specific agent** to make this specific purchase?\n- **What's the spending ceiling** for this task, not just this API key?\n- **Which merchants** is this agent allowed to transact with?\n- **Does a human need to approve** transactions above a threshold?\n- **Can we trace** this payment back to the human principal who delegated authority?\n\nAPS commerce delegation answers all five.\n\n## How It Works\n\n```\nAgent wants to pay for API credits\n       │\n       ▼\n┌─────────────────────────┐\n│  APS 4-Gate Preflight   │\n│                         │\n│  1. Passport valid?     │  ← Agent identity (Ed25519)\n│  2. Scope authorized?   │  ← Delegation includes commerce\n│  3. Budget remaining?   │  ← Spend tracking per delegation\n│  4. Merchant allowed?   │  ← Allowlist check\n│                         │\n│  All gates pass? ──────►│──── Stripe processes payment\n│  Any gate fails? ──────►│──── Payment blocked, receipt emitted\n└─────────────────────────┘\n       │\n       ▼\n  Signed ActionReceipt\n  (links payment → delegation → human principal)\n```\n\n## Works With\n\n- **Stripe Agent Toolkit** — wraps LangChain/CrewAI/Vercel AI SDK tools\n- **Stripe MPP** (Machine Payments Protocol) — governs agent-to-service payments\n- **Stripe x402** — governs USDC micropayments on Base\n- **Stripe SPTs** (Shared Payment Tokens) — governs agentic network tokens\n\n## Quick Start\n\n```bash\nnpm install @aeoess/stripe-governance agent-passport-system\n```\n\n```typescript\nimport { governMPPPayment } from '@aeoess/stripe-governance'\nimport { createPassport, createCommerceDelegation } from 'agent-passport-system'\n\n// Human principal sets up agent with commerce authority\nconst delegation = createCommerceDelegation({\n  delegatorKeys: humanKeys,\n  agentPublicKey: agentKeys.publicKey,\n  spendLimit: 50000,                    // $500.00\n  currency: 'usd',\n  allowedMerchants: ['api.openai.com'], // only approved vendors\n  requireHumanApproval: true,\n  humanApprovalThreshold: 10000,        // human approves above $100\n})\n\n// Agent receives MPP payment request from a service\nconst result = await governMPPPayment(config, {\n  amount: 4999,\n  currency: 'usd',\n  merchant: 'api.openai.com',\n  resource: 'GPT-4 API credits',\n  paymentMethod: 'spt',\n})\n\n// result.authorized === true\n// result.receipt links this payment to the delegation chain\n// result.remainingBudget === 45001 ($450.01)\n```\n\n## Integration with Stripe Agent Toolkit\n\n```typescript\nimport { createStripeAgentToolkit } from '@stripe/agent-toolkit/langchain'\nimport { governStripeTools } from '@aeoess/stripe-governance'\n\n// Standard Stripe setup\nconst toolkit = await createStripeAgentToolkit({\n  secretKey: process.env.STRIPE_SECRET_KEY\n})\n\n// Wrap with APS governance\nconst governedTools = governStripeTools(toolkit.getTools(), {\n  passport: agentPassport,\n  delegation: commerceDelegation,\n  onHumanApprovalRequired: async (request) => {\n    // Send Slack notification, wait for human response\n    return await notifyHumanViaSlack(request)\n  },\n  onReceipt: (receipt) => {\n    // Log to your audit system\n    await auditLogger.log(receipt)\n  },\n})\n\n// Use governedTools with your LangChain agent\n// Every payment tool call goes through APS preflight first\n```\n\n## Financial Observability\n\n```typescript\nimport { getAgentBudgetStatus } from '@aeoess/stripe-governance'\n\nconst status = getAgentBudgetStatus(config)\n// {\n//   agentId: 'agent-procurement-abc123',\n//   spendLimit: 500.00,\n//   spentAmount: 249.99,\n//   remainingBudget: 250.01,\n//   utilizationPercent: 49.99,\n//   humanApprovalThreshold: 100.00,\n//   approvedMerchants: ['api.openai.com', 'vercel.com']\n// }\n```\n\n## Run the Demo\n\n```bash\nnpx tsx examples/stripe-governance/demo.ts\n```\n\nShows four scenarios: auto-approved payment, human-approval-required payment, unauthorized merchant (blocked), and budget exhaustion (blocked).\n\n## Architecture\n\nAPS provides the **authorization layer**. Stripe provides the **settlement layer**.\n\n| Concern | Who Handles It |\n|---------|---------------|\n| Agent identity | APS (Ed25519 passport) |\n| Spend authorization | APS (commerce delegation) |\n| Merchant allowlisting | APS (delegation scope) |\n| Human escalation | APS (approval threshold) |\n| Audit trail | APS (signed receipts) |\n| Money movement | Stripe (MPP/SPT/x402) |\n| Payment processing | Stripe (PaymentIntents API) |\n| Fraud detection | Stripe (Radar) |\n| Tax calculation | Stripe (Tax) |\n\n## License\n\nApache-2.0. Part of the [Agent Passport System](https://github.com/aeoess/agent-passport-system).\n","readmeFilename":"README.md","_rev":"1-f637201f9a5f53ba33ba2bba817a6b3b"}