One line of code. Three currencies. Alipay · WeChat Pay · USDC · ETH. Auto-routed by currency — one PayPackTool, three settlement networks. Featured use case: Zhihui Trading Terminal (production quant trading platform).
Project description
paypack-langchain
One line of code. Three currencies. Alipay · WeChat Pay · USDC · ETH.
pip install paypack-langchain
from paypack_langchain import PayPackTool
tool = PayPackTool(api_key="ppk_...", base_url="https://rhcjw.com/pay")
result = tool.run(amount=0.01, subject="AI data query")
# → Order created, ¥0.01, scan to pay
Quick Start
Step 1: Get API Key
curl -X POST https://rhcjw.com/pay/v1/register \
-H "Content-Type: application/json" \
-d '{"name": "my_project"}'
# → {"api_key": "ppk_your_api_key"}
Step 2: Create a payment
from paypack_langchain import PayPackTool
tool = PayPackTool(
api_key="ppk_your_api_key",
base_url="https://rhcjw.com/pay" # PayPack Cloud
)
result = tool.run(amount=0.01, subject="AI data query")
print(result)
Step 3: Check payment status
from paypack_langchain import PayPackQueryTool
query = PayPackQueryTool(
api_key="ppk_your_api_key",
base_url="https://rhcjw.com/pay"
)
print(query.run(order_id="PP2026071400ABC123"))
# → {"status": "success", "amount": 0.01}
Use with LangChain Agent
from langchain.agents import create_react_agent, AgentExecutor
from langchain_openai import ChatOpenAI
from langchain_core.tools import Tool
from paypack_langchain import PayPackTool
pay_tool = PayPackTool(
api_key="ppk_your_api_key",
base_url="https://rhcjw.com/pay"
)
tools = [
Tool(
name="pay_for_data",
func=lambda q: pay_tool.run(amount=0.01, subject=q),
description="Call when user needs paid data. Returns payment QR code."
)
]
llm = ChatOpenAI(model="gpt-4")
agent = create_react_agent(
llm, tools,
prompt="You are a data assistant. For paid data, call pay_for_data first."
)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
result = executor.invoke({"input": "Get latest market data"})
print(result)
Supported Currencies
| Currency | Route | Networks | Example |
|---|---|---|---|
| CNY | PayPack Cloud | Alipay | currency="CNY" |
| CNY | PayPack Cloud | WeChat Pay | currency="CNY" |
| USDC | On-chain (local sign) | Base / Ethereum / Polygon / Arbitrum | currency="USDC", to="0x..." |
| ETH | On-chain (local sign) | Base / Ethereum / Polygon / Arbitrum | currency="ETH", to="0x..." |
Auto-routed by currency parameter — one tool, three currencies.
Featured Use Case: 志辉交易系统 (Zhihui Trading Terminal)
志辉交易系统 is a live quantitative trading platform that uses PayPack as its native payment layer:
- AI strategy agents autonomously pay for market data API calls
- Contest participants subscribe to backtesting engine time via WeChat/Alipay
- Risk management alerts trigger on-chain USDC settlements
This is not a toy demo — it's a production trading system processing real CNY and USDC payments every day.
👉 See it in action: https://rhcjw.com/pay
API Reference
PayPackTool (Create Payment)
| Param | Type | Required | Description |
|---|---|---|---|
api_key |
string | for CNY | API Key (ppk_...) |
base_url |
string | for CNY | https://rhcjw.com/pay |
private_key |
string | for USDC/ETH | Wallet private key or PRIVATE_KEY env var |
network |
string | optional | Default base-sepolia. Options: base-mainnet, base-sepolia, ethereum-mainnet, ethereum-sepolia, polygon-mainnet, arbitrum-mainnet |
broadcast |
bool | no | True = broadcast to chain, False = dry-run sign only |
amount |
float | yes | Amount (CNY in yuan, USDC/ETH in token units) |
subject |
string | yes | Description shown on payment page |
currency |
string | no | CNY (default) / USDC / ETH |
to |
string | for USDC/ETH | Recipient wallet address 0x... |
callback_url |
string | no | Webhook for payment result notification |
PayPackQueryTool (Check Payment)
| Param | Type | Required | Description |
|---|---|---|---|
api_key |
string | yes | API Key |
base_url |
string | yes | https://rhcjw.com/pay |
order_id |
string | yes | Order ID from PayPackTool response |
Links
- Live demo: https://rhcjw.com/pay
- GitHub: https://github.com/rhcjw/paypack
- Issues: https://github.com/rhcjw/paypack/issues
Legacy users: the old langchain-paypack package is deprecated. Migrate to paypack-langchain for the latest features.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paypack_langchain-0.1.8.tar.gz.
File metadata
- Download URL: paypack_langchain-0.1.8.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d194a05c7243896eeb6a9e8d020385af150dadf9f520142b615857d5d84a25fa
|
|
| MD5 |
070469b2fab244beaa2b54fcd8b73103
|
|
| BLAKE2b-256 |
adec01b25f0548b82e601dfad85838551549022653c5b51b18b072724baa08eb
|
File details
Details for the file paypack_langchain-0.1.8-py3-none-any.whl.
File metadata
- Download URL: paypack_langchain-0.1.8-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
129807bc69e59e59c8e943f7cdaf2995a680351510926e585248a62f56d53ef3
|
|
| MD5 |
3a40f60c40ec1621af91431bceaa8a62
|
|
| BLAKE2b-256 |
2557c1f0c1fe7cc0a36532c5821de96d7ef1c37e4b613a4e9b45164e33245a22
|