@asgpay/pay
v1.0.1
Published
ASG Pay — the banking layer for autonomous AI agents. Multi-chain payments (x402 + MPP), virtual cards, policy engine, 15 networks. The only SDK unifying Coinbase x402 and Stripe Machine Payments Protocol into one npm install.
Maintainers
Keywords
Readme
The Problem
$28 trillion in AI-driven commerce by 2030 — but agents can't pay.
Traditional payment rails require human input: clicking checkout buttons, entering card numbers, passing CAPTCHAs. When an AI agent encounters HTTP 402 Payment Required, it stops dead. No bank account. No wallet. No identity.
The entire agentic economy is blocked by a missing financial layer.
The Solution
ASG Pay is that missing layer. It gives every AI agent a complete financial identity — wallet, policy engine, virtual cards, and multi-chain settlement — in one line of code:
npm install @asgpay/payimport { OwsClient, EvmPaymentAdapter } from '@asgpay/pay';
const agent = new OwsClient({
baseURL: 'https://api.example.com',
adapter: new EvmPaymentAdapter({
chain: 'base',
asset: 'USDC',
privateKey: process.env.AGENT_KEY as `0x${string}`,
}),
policy: { maxAmountPerTransaction: 5, monthlyBudget: 100 },
});
// Agent pays automatically — zero payment logic needed
const data = await agent.performTask('/v1/inference', { model: 'gpt-4' });What happens: Request → 402 Payment Required → auto-detect protocol → settle on-chain → retry with proof → 200 OK. Your agent never sees the payment.
Why ASG Pay Wins
Product Suite
ASG Pay is the engine behind the full ASG financial infrastructure for AI agents:
| Package | What It Does | Install |
|---------|-------------|---------|
| @asgpay/pay | Multi-chain payment SDK (x402 + MPP) | npm i @asgpay/pay |
| @asgpay/sdk | Virtual Mastercard management | npm i @asgpay/sdk |
| @asgpay/cli | Card creation & management CLI | npx @asgpay/cli |
| @asgpay/mcp-server | AI agent tools (Claude, Codex, Cursor) | npx @asgpay/mcp-server |
| @asgpay/fund | One-link agent wallet funding | npm i @asgpay/fund |
| @asgpay/agent-cash | Autonomous virtual credit cards | npm i @asgpay/agent-cash |
| @asgpay/create-app | Project scaffolding | npx @asgpay/create-app |
How It Works
┌─────────────────────────────────────────────────────────┐
│ YOUR AI AGENT │
│ (LangChain, CrewAI, AutoGPT, custom) │
│ │
│ agent.performTask('/api/data') │
│ │ │
│ ▼ │
│ ┌──────────────────────────────────┐ │
│ │ ASG Pay Engine (OwsClient) │ │
│ │ ┌────────────┐ ┌──────────────┐ │ │
│ │ │ x402 Auto │ │ MPP Auto │ │ │
│ │ │ Detection │ │ Detection │ │ │
│ │ └─────┬──────┘ └──────┬───────┘ │ │
│ │ │ │ │ │
│ │ ┌─────▼───────────────▼───────┐ │ │
│ │ │ Policy Engine (4-gate) │ │ │
│ │ │ amount │ per-tx │ monthly │ │ │
│ │ │ │ whitelist │ │ │
│ │ └───────────┬─────────────────┘ │ │
│ │ │ │ │
│ │ ┌───────────▼─────────────────┐ │ │
│ │ │ Settlement Adapters │ │ │
│ │ │ EVM │ Stellar │ Solana │ │ │ │
│ │ │ Stripe MPP │ │ │
│ │ └─────────────────────────────┘ │ │
│ └──────────────────────────────────┘ │
│ │ │
│ ▼ │
│ 200 OK — agent gets data │
└─────────────────────────────────────────────────────────┘Supported Networks
| Network | Protocol | Assets | Status | |---------|----------|--------|:------:| | Base | x402 | ETH, USDC | ✅ Live | | Arbitrum | x402 | ETH, USDC | ✅ Live | | Optimism | x402 | ETH, USDC | ✅ Live | | Ethereum | x402 | ETH, USDC | ✅ Live | | Polygon | x402 | MATIC, USDC | ✅ Live | | Stellar | x402 + MPP | XLM, USDC | ✅ Live | | Solana | x402 | SOL, USDC | ✅ Live | | Stripe | MPP | USD (fiat) | ✅ Live |
All testnets supported. All USDC contracts are Circle's official native deployments.
Competitive Landscape
| Capability | ASG Pay | Stripe (MPP only) | Coinbase (x402 only) | Circle | |------------|:---:|:---:|:---:|:---:| | Dual Protocol (x402 + MPP) | ✅ | ❌ | ❌ | ❌ | | Virtual Cards for Agents | ✅ | Raw API | ❌ | ❌ | | Multi-chain (15 networks) | ✅ | ❌ | Base only | ❌ | | Fail-closed Policy Engine | ✅ | ❌ | ❌ | ❌ | | Agent Identity (DID/EAS) | ✅ | ❌ | ❌ | ❌ | | MCP Tools (AI-native) | ✅ | ❌ | ❌ | ❌ | | One-line Integration | ✅ | ❌ | ❌ | ❌ | | Open Source | ✅ | ❌ | Partial | ❌ |
No other SDK unifies x402 and MPP protocols, supports 15 networks, includes virtual cards, and ships with a fail-closed policy engine.
Market Opportunity
| Metric | Value | Source | |--------|-------|--------| | Agentic AI TAM (2030) | $28T | Gartner 2025 | | Agent transactions requiring payments | 47% | McKinsey Digital | | Enterprise AI agent adoption | 85% by 2027 | Deloitte | | x402 + MPP protocol coverage | ~90% of agent payments | ASG Research |
ASG Pay is positioned as Stripe for autonomous agents — the default payment infrastructure for the $28T agentic economy.
Traction
| Metric | Value | |--------|-------| | NPM Packages | 7 published | | Test Coverage | 269 tests, 84% coverage | | Networks Supported | 15 (production + testnet) | | Protocols | 2 (x402 + MPP) | | MCP Tools | 11 tools for Claude/Codex/Cursor | | Production Deployments | pay.asgcard.dev · asgcard.dev · fund.asgcard.dev |
Quick Start Examples
import { OwsClient, EvmPaymentAdapter } from '@asgpay/pay';
const agent = new OwsClient({
baseURL: 'https://api.example.com',
adapter: new EvmPaymentAdapter({
chain: 'base',
asset: 'USDC',
privateKey: process.env.AGENT_KEY as `0x${string}`,
}),
policy: { maxAmountPerTransaction: 5, monthlyBudget: 100 },
});
const result = await agent.performTask('/v1/data');import { OwsClient, StellarPaymentAdapter } from '@asgpay/pay';
const agent = new OwsClient({
baseURL: 'https://api.example.com',
adapter: new StellarPaymentAdapter({
secretKey: process.env.STELLAR_SECRET!,
network: 'mainnet',
asset: 'USDC',
}),
policy: { monthlyBudget: 50, maxAmountPerTransaction: 2 },
});import { OwsClient, SolanaPaymentAdapter } from '@asgpay/pay';
const agent = new OwsClient({
baseURL: 'https://api.example.com',
adapter: new SolanaPaymentAdapter({
secretKey: myKeypair.secretKey,
network: 'mainnet-beta',
asset: 'USDC',
}),
policy: { monthlyBudget: 50, maxAmountPerTransaction: 2 },
});import { OwsClient, StripePaymentAdapter } from '@asgpay/pay';
const agent = new OwsClient({
baseURL: 'https://api.example.com',
adapter: new StripePaymentAdapter({
stripeSecretKey: process.env.STRIPE_SECRET_KEY!,
networkId: 'my-network',
}),
policy: { monthlyBudget: 200, maxAmountPerTransaction: 10 },
});import { createPaymentGate } from '@asgpay/pay';
app.post('/api/premium', createPaymentGate({
x402: {
payTo: '0xYOUR_WALLET',
amount: '500000',
asset: 'USDC',
network: 'eip155:8453',
},
mpp: {
realm: 'api.example.com',
method: 'onchain',
amount: '0.50',
recipient: '0xYOUR_WALLET',
},
}), (req, res) => {
res.json({ data: 'premium content' });
});Technology Stack
| Layer | Technology |
|-------|-----------|
| EVM | viem — type-safe Ethereum client |
| Stellar | @stellar/stellar-sdk |
| Solana | @solana/web3.js + @solana/spl-token |
| Payments | Stripe API 2026-03-04.preview (native MPP/SPT) |
| Build | TypeScript strict mode, dual CJS + ESM |
| Test | Vitest — 269 tests, 84% coverage |
| CI/CD | GitHub Actions — Node 18/20/22 matrix |
FAQ
Is ASG Pay free? Yes. Apache 2.0. You only pay gas fees or Stripe fees.
Does it work with LangChain / CrewAI / AutoGPT? Yes. Any JS/TS agent framework.
Can agents pay each other? Yes. Pay Out + Pay In + buildPaymentUri() for agent-to-agent.
How do I add a new chain? Implement PaymentAdapter (~40 lines of TypeScript).
Is this the same as @asgcard/pay? Yes. @asgpay/pay and @asgcard/pay are both official packages by ASG Compute. Use whichever you prefer.
Links
| | | |---|---| | 🌐 Website | pay.asgcard.dev | | 💳 Virtual Cards | asgcard.dev | | 💰 Agent Funding | fund.asgcard.dev | | 📦 NPM | @asgpay/pay | | 🐙 GitHub | ASGCompute | | 𝕏 Twitter | @ASGCardx402 |
