🚀 开发者控制台 — 注册即获 API Key,支付宝/微信充值,30 秒接入。
三种用法,按需选择:
方式 适合谁 费用 🆓 开源 SDK pip install langchain-paypack自己管私钥的开发者 免费 ☁️ 托管 Cloud rhcjw.com/pay/dashboard 不想管私钥、直接用 充值预付费 🔧 私有部署 本仓库完整代码 企业自建支付系统 自己运维
专为 AI Agent 设计的通用支付中间件。一行代码接入支付宝、微信支付及加密货币网络,打破生态壁垒,让 AI 自主完成跨平台交易。
PayPack is the ONLY payment middleware that supports x402/AP2 crypto payments AND Alipay/WeChat fiat payments. PayPack 是唯一同时支持 x402/AP2 链上支付和支付宝/微信法币支付的 AI 支付中间件。
| Tool | Payment Method | Supports China Users? |
| 工具 | 支付方式 | 支持中国用户? |
|---|---|---|
| Ampersend | x402 + USDC | ❌ No Alipay/WeChat |
| GOAT | Crypto | ❌ No Alipay/WeChat |
| Stripe Agent Toolkit | Stripe (credit card) | ❌ Foreign cards only |
| Nevermined | x402 protocol | ❌ No Alipay/WeChat |
| Privy | Wallet infra | ❌ No Alipay/WeChat |
| PayPack ✅ | x402/AP2 + USDC/ETH + Alipay + WeChat Pay | ✅ Open-source & free |
| PayPack Cloud ☁️ | Managed payment API — Alipay + WeChat Pay | ✅ Live at rhcjw.com/pay |
While everyone asks "how does AI pay with USDC?", PayPack asks "how does AI pay with Alipay and WeChat?". 当所有人在琢磨"怎么让 AI 用 USDC 付钱"时,PayPack 在想"怎么让 AI 用支付宝和微信付钱"。
1.3 billion people in China use Alipay and WeChat — not USDC. Only PayPack serves this market. 国内 13 亿人用支付宝和微信,不用 USDC。这个市场,只有 PayPack 在做。
from paypack import AgentPay
pay = AgentPay(
wallet_config={"private_key": "your-key"},
network="base-sepolia",
spend_limit_daily=10.0,
)
# AI auto-handles HTTP 402 payment requests | AI 自动处理 HTTP 402 支付要求
import requests
response = requests.get("https://api.data-provider.com/premium")
if response.status_code == 402:
content = pay.auto_handle_402(response)
# Or send payment directly | 或直接发送支付
receipt = pay.send(to="0xRecipientAddress", amount=0.001, currency="USDC")
print(receipt["tx_hash"])from paypack.signer.alipay import AlipaySigner
from paypack import AgentPay
# Two lines to integrate Alipay | 两行代码接入支付宝
signer = AlipaySigner(app_id="your APPID", private_key_path="key.pem",
alipay_public_key_path="alipay_public_key.pem", sandbox=True)
pay = AgentPay(signer=signer, network="alipay")
# AI pays in yuan | AI 直接付人民币
receipt = pay.send(to="user_alipay_id", amount=0.01, currency="CNY",
subject="AI Data Subscription | AI 数据订阅费")# Web payment — generates cashier URL, user scans QR to pay | 电脑网站支付 — 生成收银台链接,用户扫码即付
pay_url = signer.page_pay(
out_trade_no="ORDER_20260709_001",
total_amount=9.90,
subject="AI Agent API Monthly Fee | AI Agent API 调用月费",
body="Auto-generated by PayPack | PayPack 自动生成的支付订单"
)
# User opens pay_url to complete payment | 用户打开 pay_url 即可扫码支付# paypack_wechat is a commercial module, requires License Key
# paypack_wechat 为商业模块,需要 License Key
# Source includes a template: paypack_wechat_run.example.py | 开源代码包里包含示例模板
from paypack_wechat import WechatSigner
from paypack import AgentPay
signer = WechatSigner(
mchid="Merchant ID | 商户号",
serial_no="Certificate S/N | 证书序列号",
private_key_path="apiclient_key.pem",
api_v3_key="APIv3 Key | APIv3密钥",
license_key="PAYPACK-WECHAT-v1-...",
app_id="Mini Program AppID | 小程序AppID",
notify_url="https://your-domain.com/wechat/notify",
)
pay = AgentPay(signer=signer, network="wechat")
# AI initiates WeChat Pay → frontend calls wx.requestPayment()
# AI 发起微信支付 → 前端调起 wx.requestPayment()
result = pay.send(
to="User OpenID | 用户openid",
amount=9.90,
currency="CNY",
subject="AI Monthly Subscription | AI 服务月费",
app_id="Mini Program AppID | 小程序AppID",
)
# result["prepay_params"] passes directly to frontend | 直接传给前端调起支付不想自己管理密钥和商户号?直接用 PayPack Cloud API:
# 注册获取 API Key
curl -X POST https://rhcjw.com/pay/v1/register \
-H "Content-Type: application/json" \
-d '{"name": "myapp", "email": "user@example.com"}'
# 创建支付宝支付
curl -X POST https://rhcjw.com/pay/v1/pay \
-H "Authorization: Bearer ppk_xxx" \
-d '{"amount": 0.01, "subject": "AI 服务", "channel": "alipay"}'
# 创建微信支付
curl -X POST https://rhcjw.com/pay/v1/pay \
-H "Authorization: Bearer ppk_xxx" \
-d '{"amount": 0.01, "subject": "AI 服务", "channel": "wechat"}'from langchain_paypack import PayPackTool
tool = PayPackTool(
private_key="0x...",
wallet_address="0x...",
network="base-sepolia",
spend_limit_daily=10.0,
)
# AI Agent calls directly | AI Agent 直接调用
result = tool._run(to="0x...", amount=0.001, currency="USDC")💡 Compare: integrating Alipay yourself means hundreds of pages of docs, hundreds of lines of code, sandbox/RSA2 signing/verify/callbacks. PayPack: two lines. 💡 对比:自己对接支付宝要读几百页文档、写几百行代码、处理沙箱/RSA2签名/验签/回调。PayPack 两行搞定。
# In Dify: Plugins → Install from GitHub | 在 Dify 中:插件 → 从 GitHub 安装
# Enter: https://github.com/rhcjw/paypackOr download paypack-0.1.2.difypkg and upload locally. | 或下载直接上传。
See QUICKSTART.md — 5-minute tutorial covering all three channels. | 详见 QUICKSTART.md — 5 分钟三路教程。
| Channel | Sandbox/Test | Production | Fully Auto? |
| 通道 | 沙箱/测试 | 生产 | 全自动? |
|---|---|---|---|
| ETH / USDC (Base/Ethereum/Polygon/Arbitrum) | ✅ Verified | ✅ Live | ✅ Yes |
| Alipay CNY | ✅ Sandbox OK | ✅ Production Verified (¥0.10 paid + refunded) | |
| WeChat Pay CNY | ✅ Backend OK | ✅ Production Verified (¥0.05 paid) | |
| PayPack Cloud ☁️ | — | ✅ Live at rhcjw.com/pay | ✅ API Key auth |
AI Agent Application
│
▼
PayPack SDK ◄── You are here 你在这里
│
┌───────┼───────┐
│ │ │
Protocol Payment Security
Parser Router Fuse
(x402/ (USDC/ (Limits/
AP2) CNY) Audit)
│ │ │
└───────┼───────┘
│
▼
Settlement Networks
(Base / Alipay / WeChat / More...)
PayPack doesn't invent new protocols. It wraps scattered capabilities into a single agent.pay().
PayPack 不发明新协议,而是把零散的能力封装成一个 agent.pay()。
- Multi-Protocol | 多协议: x402 + AP2 auto-detect and route | 自动检测和路由
- 3-Channel | 三通道: USDC/ETH on-chain + Alipay CNY + WeChat Pay CNY
- Cloud API | 云托管: No key management needed, pay-as-you-go | 无需管理密钥,按次计费
- Signer Abstraction | 签名器抽象: LocalSigner (dev) / AWSKMSSigner (prod, key never leaves HSM)
- Nano-Payment | 纳米支付: ERC-4337 batch settlement, saves gas | 批量结算省 Gas
- Safety Fuse | 安全熔断: Daily spend limit, balance check, auditable receipts | 日限额、余额检查、可审计收据
- RPC Failover | RPC 故障转移: Multi-node auto-switch (v0.5) | 多节点自动切换
- Tx Retry | 交易重试: RBF + exponential backoff (v0.5) | RBF + 指数退避
- Limit Persistence | 限额持久化: Redis / SQLite / Memory (v0.5)
- LangChain Native | LangChain 原生:
PayPackToolplug-and-play | 即插即用 - Dify Plugin | Dify 插件: v0.1.2 — pay/query/refund tools
| Network | Chain ID | Currency | 币种 |
|---|---|---|---|
| Base Sepolia (testnet) | 84532 | ETH, USDC | |
| Base Mainnet | 8453 | ETH, USDC | |
| Ethereum Mainnet | 1 | ETH, USDC | |
| Polygon Mainnet | 137 | POL, USDC | |
| Arbitrum Mainnet | 42161 | ETH, USDC | |
| **Alipay Sandbox | 支付宝沙箱** | — | CNY |
| **Alipay Production ✅ | 支付宝生产** | — | CNY (¥0.10 verified) |
| **WeChat Pay ✅ | 微信支付** | — | CNY (¥0.05 verified) |
| PayPack Cloud ☁️ | — | CNY | Live |
pip install langchain-paypackOr from Gitee (faster in China) | 或从 Gitee 安装(国内更快):
pip install https://gitee.com/rhcjw_com/paypack/raw/master/dist/langchain_paypack-0.5.0-py3-none-any.whl| Currency | Amount | Transaction | 交易凭证 |
|---|---|---|---|
| ETH | 0.0001 ETH | d5f7ec94342c26a132289a9898ffd4885010089d1ddba19951117618a3992127 |
|
| USDC | 0.001 USDC | c4c24c4c1c8fd2ae738ed91cd87596ad2c672337b5ebf6d42a392adf61760e27 |
|
| CNY (Alipay) | 0.63 yuan | Sandbox TX: 2026070922001406640510096995 |
|
| CNY (Alipay) | ¥0.10 | Production ✅ 2026071122001479581453918172 (paid + refunded) |
|
| CNY (WeChat) | ¥0.05 | Production ✅ Native QR scan & pay |
| Version | Goal | 目标 | Status |
|---|---|---|---|
| v0.1 | Base testnet x402 payment loop (ETH + USDC) | ✅ | |
| v0.2 | AP2 protocol support | ✅ | |
| v0.3 | LangChain plugin published | ✅ | |
| v0.4 | Signer abstraction + ERC-4337 batch settlement | ✅ | |
| v0.5 | RPC failover + retry + limit persistence | ✅ | |
| 🔌 Dify Plugin | Pay/Query/Refund tools | ✅ v0.1.2 | |
| v0.6 | Alipay production launch | ✅ (¥0.10 paid + refunded on 2026-07-11) | |
| v0.7 | WeChat Pay production launch | ✅ (¥0.05 paid on 2026-07-12) | |
| v1.0 | PayPack Cloud managed service | ✅ Live at rhcjw.com/pay |
- Stablecoin annual volume hit $33 trillion (2025) — 20x PayPal | 稳定币年交易量突破 $33 万亿
- AI Agent count projected at 22 billion (McKinsey) | AI Agent 数量预计达 220 亿
- x402 protocol already processes tens of millions of tx on Solana | x402 协议已在 Solana 上处理数千万笔交易
- LangChain/LlamaIndex payment plugin market is completely empty | 支付插件市场完全空白
- Alipay "AI Pay" initiative launching 2026 — PayPack is the first to bridge it with x402 | 支付宝"AI 付"计划 2026 年启动
PayPack isn't just for LangChain. Hundreds of thousands of developers use these platforms — none of them have payment tools. PayPack 不只是 LangChain 生态的工具。国内数十万开发者在用这些平台——它们全都没有支付工具。
| Platform | Users | 用户量 | Has Payment? | 有支付工具吗? |
|---|---|---|---|---|
| Dify | 100K+ | 数十万 | ✅ PayPack Plugin | |
| Coze (ByteDance) | 1M+ | 数百万 | ❌ None | |
| Baidu Qianfan | 100K+ | 数十万 | ❌ None | |
| Tongyi Bailian | 100K+ | 数十万 | ❌ None |
These developers are PayPack's real users. | 这些平台的开发者,才是 PayPack 真正的用户。
| Phase | Milestone | 里程碑 | Status |
|---|---|---|---|
| v0.1-v0.7 | x402/AP2 + Alipay/WeChat integration | 双协议双通道 | ✅ Done |
| v1.0 | PayPack Cloud live | 云服务上线 | ✅ Live |
| v1.1 | AI Service Price Index (alpha) — anonymized pricing from Dify plugin transactions, published as a neutral oracle | AI 服务价格指数(α版) | 🔜 Planned |
| v1.2 | Catalog — 20+ API vendors with SLA guarantees | API 厂商目录 | 🔜 Planned |
| v2.0 | SLA Arbitration — neutral dispute resolution for Agent-to-API payments | 中立仲裁层 | 🔜 Future |
PayPack stays neutral by design — open to all platforms, all channels. No strategic investor gets a veto. The Price Index is aggregated, anonymized, and platform-agnostic.
价格指数:基于真实 Agent 支付交易的匿名脱敏数据,输出中立定价 oracle,全程不向任何大厂倾斜。
| Channel | URL | 渠道 |
|---|---|---|
| GitHub | https://github.com/rhcjw/paypack | |
| Gitee (China Mirror) | https://gitee.com/rhcjw_com/paypack | Gitee(国内镜像) |
| PyPI | https://pypi.org/project/langchain-paypack/ | |
| PayPack Cloud | https://rhcjw.com/pay | 云服务 |
| Dify Plugin | paypack-0.1.2.difypkg | Dify 插件 |
| Quick Start | QUICKSTART.md | 快速入门 |
| 🆕 Developer Dashboard | https://rhcjw.com/pay/dashboard | 注册 / 充值 / API Key |
Keywords: HTTP 402 x402 AP2 AI agent payment nano payment agent pay AI 支付中间件 USDC stablecoin LangChain Pay
Star the repo, open an issue, or mention PayPack in Dify/Coze communities — every bit helps. Star ⭐、提 Issue、或者在 Dify/Coze 社区里提到 PayPack,都是贡献。
Apache License 2.0. See LICENSE.