skill
agentic-payments-bot
π€π΅ Agentic Payment Service for Open Agent Skills Ecosystem.
Set up
Skills are installed by placing their folder where your agent loads skills.
The download comes from github.com/sentient-agi/agentic-payments-bot itself, not from our server, so what you get is exactly what its author published.
Install instructions come from the README
README
synced Oct 26, 2026π€π΅ Agentic Payment Service for Open Agent Skills Ecosystem.
A tri-protocol (x402 + AP2 + MPP) agentic payment service for Open Agent Skills Ecosystem (including OpenClaw, Claude Code, Codex, Junie, OpenCode, GitHub Copilot, Gemini CLI, etc.), with web3 & web2 gateway support, EIP-3009 signed stablecoin authorizations (Viem), AWS KMS key management, policy engine compliance, audit trail, and human-in-the-loop confirmation.
Table of Contents
Overview
agentic-payments-bot is a payment serivce/gateway/bot/agent/assistant with support for and providing of X402, AP2, and MPP server and client, and providing an Open Agent Skills Ecosystem compliant skill, that enables AI agents to autonomously initiate, validate, and execute payments across both blockchain (web3) and traditional (web2) payment rails.
Key Capabilities
| Capability | Details |
|---|---|
| Triple protocol support | x402 (HTTP 402 + onchain settlement), AP2 (Google's mandate-based agent payments), and MPP (Machine Payments Protocol β rail-agnostic quote β invoice β settle β receipt lifecycle with content-addressed invoices and signed receipts) |
| Dual role: server + client | Acts as a payment gateway (accepts payments from external agents via x402/AP2/MPP server endpoints) and as a payment client (makes payments to external services via all backends) |
| Web3 transactions | Ethereum, Base, Polygon via Viem β native ETH and ERC-20 (USDC, etc.) |
| EIP-3009 signing | Full x402 client payment flow: EIP-712 TransferWithAuthorization signed via Viem with a private key decrypted through the configured KMS backend β the key never leaves the KMS trust boundary |
| Web2 gateways | Stripe, PayPal, Visa Direct, Mastercard Send, Google Pay, Apple Pay |
| Protocol gateways | x402 remote resource payment, AP2 remote mandate submission, MPP remote invoice payment β paying any service that supports these protocols |
| Key management | Pluggable KMS providers: AWS KMS, OS Keyring (KDE Wallet / GNOME Keyring / macOS Keychain / Windows Credential Manager), D-Bus Secret Service, GnuPG, Local AES-256-GCM |
| Policy engine | Per-tx limits, daily/weekly/monthly aggregates, time-of-day, blacklist/whitelist, currency restrictions |
| Human-in-the-loop | Automatic escalation on policy violations via CLI prompt, chat prompt, or web API |
| Audit trail | Every action logged to SQLite audit_log table + Winston (stdout/stderr/file) |
| Three interfaces | OpenClaw (or other agent) chat, CLI (agentic-payments-bot), REST web API |
| Fully configurable | Single YAML file controls all behavior |
Architecture
System Diagram
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Agent Payments Skill β
β β
β ββββββββββββββββββββ SERVER SIDE (Accept Payments) ββββββββββββββββββββββββββββ β
β β β β
β β External Agents βββΊ x402 Paywall Middleware (HTTP 402 flow) β β
β β AP2 Mandate Endpoints (mandate lifecycle) β β
β β MPP Endpoints (quote β invoice β settle β βββΊ Paymentβ β
β β receipt) Execution β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β βββββββββββββ βββββββββββββββββ ββββββββββββ β
β β Chat UI β β CLI (term) β β Web API β β
β βββββββ¬ββββββ βββββββββ¬ββββββββ ββββββ¬ββββββ β
β β β β β
β βΌ βΌ βΌ β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Protocol Router β β
β β (AI output parser β PaymentIntent β routing) β β
β ββββββ¬βββββββββββ¬ββββββββββ¬βββββββββββ¬βββββββββββ¬βββββ β
β β β β β β β
β ββββββΌββββ ββββββΌββββ βββββΌβββββ βββββΌβββββ βββββΌβββββ β
β β web3 β β web2 β β x402 β β ap2 β β mpp β β
β β(Viem) β β(Stripe β β(remote β β(remote β β(remote β β
β β β βPayPal β βresourceβ βmandate β βinvoice β β
β β β βVisa MC β βclient) β βclient) β βclient) β β
β β β βGPay β β β β β β β β
β β β βAPay) β β β β β β β β
β ββββββ¬ββββ βββββ¬βββββ βββββ¬βββββ βββββ¬βββββ βββββ¬βββββ β
β β β β β β β
β ββββββΌββββββββββΌβββββββββββΌβββββββββββΌβββββββββββΌβββββ β
β β Policy Engine β β
β β (compliance checks before execution) β β
β β βββββββββββββββββββββββββββββββββββββββββ β β
β β β β’ Single tx limit β’ Blacklist β β β
β β β β’ Daily/Weekly/Mo β’ Whitelist β β β
β β β β’ Time-of-day β’ Currency β β β
β β βββββββββββββββββββββββββββββββββββββββββ β β
β β β (violation?) βββΊ Human Confirm β β
β βββββββββΌβββββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββΌββββββββββββββββββββββββββββββββββββββ βββββββββββββββββ β
β β Payment Execution β β KMS Provider β β
β β ββββββββββ ββββββββββ ββββββββββ ββββββββ β β βββββββββββββ β β
β β β Viem β β Stripe β β Visa β β x402 β β β β AWS KMS β β β
β β β(ETH/ β β PayPal β β MC β β AP2 β β β β OS Keyringβ β β
β β β ERC20/ β β GPay β β β β MPP β β β β D-Bus SS β β β
β β β EIP- β β APay β β β β β ββββ β GnuPG β β β
β β β 3009) β β β β β β β β β β Local AES β β β
β β ββββββββββ ββββββββββ ββββββββββ ββββββββ β β βββββββββββββ β β
β ββββββββββββββββ¬βββββββββββββββββββββββββββββββ βββββββββββββββββ β
β β β
β ββββββββββββββββΌβββββββββββββββββββββββββββββββ β
β β SQLite β β
β β ββββββββββββββββ ββββββββββββ ββββββββββββ β β
β β βencrypted_keysβ βtransac- β βaudit_log β β β
β β β β βtions β β β β β
β β ββββββββββββββββ ββββββββββββ ββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Directory Structure
agentic-payments-bot/
βββ SKILL.md # Open Agent Skills Ecosystem compliant skill definition (YAML frontmatter + markdown)
βββ package.json # npm package manifest
βββ tsconfig.json # TypeScript compiler config
βββ .env.example # Environment variable template
βββ .gitignore
βββ config/
β βββ default.yaml # Master YAML configuration
βββ src/
β βββ index.ts # Main entry point / orchestrator
β βββ cli.ts # CLI interface (Commander.js)
β βββ web-api.ts # REST API (Express) β includes x402/AP2 server endpoints
β βββ config/
β β βββ loader.ts # YAML config loader + Zod validation
β βββ protocols/
β β βββ router.ts # Protocol router + AI output parser
β β βββ x402/
β β β βββ client.ts # x402 HTTP 402 client (paying for resources)
β β β βββ eip3009.ts # EIP-3009 TransferWithAuthorization signer (EIP-712 via Viem)
β β β βββ server.ts # x402 paywall middleware & settlement (accepting payments)
β β βββ ap2/
β β β βββ client.ts # AP2 mandate-based client (submitting mandates)
β β β βββ server.ts # AP2 mandate lifecycle server (processing mandates)
β β βββ mpp/
β β βββ types.ts # MPP shared types (Quote, Invoice, SettleRequest, Receipt)
β β βββ client.ts # MPP client (quote β invoice β settle β receipt)
β β βββ server.ts # MPP server (content-addressed invoices, signed receipts, rail dispatch)
β βββ payments/
β β βββ web3/
β β β βββ ethereum.ts # Viem-based ETH/ERC-20 tx producer
β β βββ web2/
β β βββ gateways.ts # Stripe, PayPal, Visa, MasterCard, Google Pay, Apple Pay
β βββ kms/
β β βββ provider.ts # KmsProvider interface (shared contract)
β β βββ factory.ts # Provider factory (selects backend from config)
β β βββ aws-kms.ts # Public API: encryptAndStore / retrieveAndDecrypt
β β βββ aws-kms-provider.ts # AWS KMS provider implementation
β β βββ os-keyring-provider.ts # OS Keyring via @aspect-build/keytar
β β βββ dbus-secret-service-provider.ts # Linux D-Bus Secret Service (dbus-next)
β β βββ gpg-provider.ts # GnuPG encryption for headless Linux
β β βββ local-aes-provider.ts # Local AES-256-GCM (fallback / dry-run)
β βββ dry-run/
β β βββ crypto.ts # Local AES-256-GCM encryption (no KMS)
β β βββ stubs.ts # Gateway stub responses (success/failure/random)
β β βββ wallet.ts # Viem key generation + local encrypt/store
β βββ db/
β β βββ sqlite.ts # SQLite init + migrations
β β βββ key-store.ts # Encrypted key CRUD
β β βββ transactions.ts # Transaction records + aggregates
β β βββ audit.ts # Audit trail read/write
β βββ policy/
β β βββ engine.ts # Policy rule evaluator
β β βββ feedback.ts # Human confirmation (CLI/chat/API)
β βββ logging/
β βββ logger.ts # Winston multi-transport logger
βββ data/ # (created at runtime)
β βββ payments.db # SQLite database
βββ logs/ # (created at runtime)
βββ payment-skill.log # File log output
Data Flow
Client Side β Making Payments (Agent β External Services)
User/Agent input
β
βΌ
ββββββββββββββββββββ ββββββββββββββββββββββββ
β Parse AI Output ββββββΊβ Validate JSON Schema β
β (regex + JSON) β β (Zod PaymentIntent) β
ββββββββββββββββββββ ββββββββββββ¬ββββββββββββ
β
βΌ
ββββββββββββββββββββββββ
β Protocol Router β
β (detect gateway: β
β web3/web2/x402/ β
β ap2/mpp) β
ββββββββββββ¬ββββββββββββ
β
βΌ
ββββββββββββββββββββββββ
β Create Transaction β
β Record (SQLite) β
ββββββββββββ¬ββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β Policy Engine ββββ rules from YAML
β β’ limits check ββββ aggregates from SQLite
β β’ blacklist/whitelist β
β β’ time restrictions β
ββββββββββββ¬βββββββββββββ
β
βββββββββ΄βββββββββ
β violations? β
βββββ¬βββββββββ¬ββββ
yes β β no
βΌ β
βββββββββββββββββ β
β Human Confirm β β
β (CLI/Chat/API)β β
βββββββββ¬ββββββββ β
reject β confirm β
βΌ β βββββββββ
REJECT β β
βΌ βΌ
ββββββββββββββββββββββββ
β Decrypt Keys (KMS) β
βββββββββββ¬βββββββββββββ
β
βββββββββββββββββΌβββββββββββββββββ
β β β
ββββββββββΌβββββββ ββββββββΌβββββββ βββββββββΌββββββββ
β web3 (Viem) β β web2 β β Protocol β
β ETH / ERC-20 β β Stripe β β Clients β
β β β PayPal β β β
β Direct chain β β Visa / MC β β x402: discoverβ
β transactions β β GPay / APay β β β sign EIP- β
β β β β β 3009 (KMS key)β
β β β β β β pay β
β β β β β β get resourceβ
β β β β β β
β β β β β AP2: mandate β
β β β β β β sign β cred β
β β β β β β submit β
β β β β β β
β β β β β MPP: quote β
β β β β β β invoice β
β β β β β β settle(rail)β
β β β β β β receipt β
ββββββββββ¬βββββββ ββββββββ¬βββββββ βββββββββ¬ββββββββ
β β β
βββββββββββββββββΌβββββββββββββββββ
β
βββββββββββΌββββββββββββ
β Update Transaction β
β + Audit Log β
βββββββββββββββββββββββ
Server Side β Accepting Payments (External Agents β This Service)
ββββββββββββββββββββββββββββββββββββββββ
β External Agent Request β
ββββββββ¬βββββββββββ¬βββββββββββ¬ββββββββββ
β β β
x402 path β β AP2 path β MPP path
βββββββββββββββββββ β βββββββββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ
β GET /x402/premium/data β β POST /ap2/mandates β β POST /mpp/quote β
β (any paywall route) β β (accept mandate) β β (issue quote) β
βββββββββββββ¬βββββββββββββ ββββββββββββββ¬ββββββββββββββ ββββββββββββββ¬ββββββββββββββ
β β β
ββββββββ΄βββββββ βΌ βΌ
β X-PAYMENT β ββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ
β header? β β POST /ap2/sign-mandate β β POST /mpp/invoice β
ββββ¬βββββββ¬ββββ β (credential provider) β β (content-addressed, β
no β β yes ββββββββββββββ¬ββββββββββββββ β signed invoice) β
βΌ β β ββββββββββββββ¬ββββββββββββββ
βββββββββββββββ βΌ β
β HTTP 402 ββ ββββββββββββββββββββββββββββββββ βΌ
β + payment ββ β POST /ap2/payment-credentialsβ ββββββββββββββββββββββββββββ
β requirem. ββ β (issue scoped tokens) β β POST /mpp/settle β
β in X-PAY- ββ ββββββββββββββ¬ββββββββββββββββββ β (rail: x402 / stripe / β
β MENT hdr ββ β β paypal / card / crypto) β
βββββββββββββββ βΌ ββββββββββββββ¬ββββββββββββββ
βΌ ββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββ β POST /ap2/process-payment β βΌ
β Validate payload: β ββββββββββββββ¬ββββββββββββββββ ββββββββββββββββββββββββββ
β β’ auth fields β β β GET /mpp/receipt/:id β
β β’ EIP-3009 signed β β β (signed receipt) β
β authorization β β ββββββββββββββ¬ββββββββββββ
β β’ amount β₯ required β β β
β β’ time bounds β β β
β β’ payTo matches β β β
ββββββββββββ¬βββββββββββ β β
β β β
βΌ βΌ βΌ
βββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββββββ
β Submit to on-chain β β Route to internal backend: β β Settle on chosen rail: β
β facilitator for β β β’ stripe β’ paypal β’ card β β β’ x402 β facilitator β
β settlement β β β’ crypto (Viem ETH/ERC-20) β β β’ stripe/paypal/card β
ββββββββββββ¬βββββββββββ ββββββββββββββββ¬ββββββββββββββββ β β’ crypto (tx reference) β
β β ββββββββββββββββ¬ββββββββββββ
βΌ βΌ β
βββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ β
β HTTP 200 β β Return AP2PaymentResult: β βΌ
β + resource data β β { mandate_id, status, β ββββββββββββββββββββββββββββ
β + X-PAYMENT-RESPONSEβ β transaction_id, receipt } β β Return MPPReceipt: β
β (settlement proof)β ββββββββββββββββ¬ββββββββββββββββ β { receipt_id, status, β
ββββββββββββ¬βββββββββββ β β rail_reference, sig } β
β β ββββββββββββββββ¬ββββββββββββ
ββββββββββββββββ¬βββββββββββββ΄βββββββββββββββββββββββββββββββββ
β
ββββββββββββΌβββββββββββ
β Audit Log (SQLite β
β + Winston) β
βββββββββββββββββββββββ
Quick Start
A quick start guide with Docker and Docker Compose.
Usage
Quick start (dry-run, no credentials needed):
# Build and start both services
DRY_RUN=true docker compose up --build -d
# Start everything (first run auto-configures OpenClaw + installs skill)
docker compose up -d
# Or explicitly run skill installation first
docker compose --profile setup run --rm install-skill
docker compose up -d
# Check the payment API health
curl http://localhost:3402/api/v1/health
# Run the demo via the CLI helper
DRY_RUN=true docker compose run --rm cli demo
# Run CLI commands
docker compose run --rm --profile cli cli demo --stub-mode success
# Quick dry-run test
DRY_RUN=true docker compose up -d
# Check logs
docker compose logs -f agentic-payments-bot
# View audit log
DRY_RUN=true docker compose run --rm cli audit --limit 30
# Store a key via CLI
DRY_RUN=true docker compose run --rm cli keys list
Production (with real credentials):
# Create a .env file with your secrets
cat > .env <<EOF
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
AWS_KMS_KEY_ID=arn:aws:kms:us-east-1:123456789012:key/...
LLM_PROVIDER=anthropic
LLM_API_KEY=sk-ant-...
OPENCLAW_GATEWAY_TOKEN=your-gateway-token
EOF
# Start
docker compose up --build -d
# Tail logs
docker compose logs -f agentic-payments-bot
# Stop
docker compose down
Pair OpenClaw with a messaging channel (e.g. Telegram):
# Run the OpenClaw CLI inside the running container
docker compose exec agentic-payments-bot openclaw pairing approve telegram
What this gives you
| Container | Service | Port | Description |
|---|---|---|---|
agentic-payments-bot | Payment Bot Web API (npm run web) | 3402 | REST API for payments, parsing, confirmations, audit |
agentic-payments-bot | OpenClaw Gateway (openclaw gateway) | 18789 | Agent gateway (Telegram, Slack, WhatsApp, etc.) |
agentic-payments-bot | OpenClaw Bridge (openclaw) | 18790 | Internal bridge for multi-channel routing |
agentic-payments-bot | CLI (on-demand) (npm run cli) | β | Runs agentic-payments-bot CLI commands against the shared SQLite DB |
Both services share the same SQLite database and encrypted key store through Docker volumes [1]. The payment skill is auto-registered as an OpenClaw skill via the symlink into ~/.openclaw/skills/ [2], so the agent discovers it at startup through the standard skill loading mechanism.
Documentation
See the REFERENCE_README file for the full exhaustive comprehensive thorough documentation and details.
License
This project is licensed under the Apache 2.0 License. See the LICENSE-APACHE file for the details.
Built with π€π΅ for the Open Agent Skills Ecosystem and for the OpenClaw ecosystem.