snaplii-agent-payments
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSnaplii Agent Payments
Snaplii Agent支付功能
Skill by ara.so — AI Agent Skills collection.
Snaplii unlocks real-world commerce for AI agents through a safe, tokenized payment layer powered by 500+ merchant gift cards. It's the only payment solution that saves you money (up to 10% per transaction) while maintaining security through pre-funded, isolated, non-reusable transactions.
由ara.so提供的Skill — AI Agent Skills合集。
Snaplii通过由500+商户礼品卡支持的安全代币化支付层,为AI Agent解锁真实世界的商业消费能力。这是唯一一款既能为你省钱(每笔交易最高省10%),又能通过预充值、隔离、不可重复使用的交易保障安全性的支付解决方案。
What It Does
功能介绍
Snaplii solves the payment problem for AI agents:
- Safe: No shared credentials, each transaction is pre-funded and isolated
- Controlled: Users fund Snaplii Cash, agents operate within strict boundaries
- Value-added: Up to 10% savings that stack with existing merchant deals
- Tokenized: 500+ merchant gift cards available (CA and US)
The flow: User → Agent → Snaplii → Merchant
Snaplii解决了AI Agent的支付难题:
- 安全可靠:无共享凭证,每笔交易均为预充值且独立隔离
- 可控性强:用户充值Snaplii Cash,Agent在严格限制范围内操作
- 增值优惠:最高10%的折扣可与商户现有优惠叠加使用
- 代币化支持:覆盖加拿大和美国的500+商户礼品卡
流程:用户 → Agent → Snaplii → 商户
Installation
安装步骤
Requirements
前置要求
Clone the Repository
克隆仓库
bash
git clone https://github.com/Snaplii-Inc/agent-to-merchant-payments.git
cd agent-to-merchant-paymentsbash
git clone https://github.com/Snaplii-Inc/agent-to-merchant-payments.git
cd agent-to-merchant-paymentsInstall CLI with pipx (Recommended)
使用pipx安装CLI(推荐)
macOS:
bash
brew install pipx
pipx ensurepath
pipx install -e ./snaplii-cliLinux:
bash
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install -e ./snaplii-cliWindows (with Scoop):
powershell
scoop install pipx
pipx ensurepath
pipx install -e ./snaplii-cliAfter installation, restart your terminal and verify:
bash
snaplii --helpmacOS系统:
bash
brew install pipx
pipx ensurepath
pipx install -e ./snaplii-cliLinux系统:
bash
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install -e ./snaplii-cliWindows系统(搭配Scoop):
powershell
scoop install pipx
pipx ensurepath
pipx install -e ./snaplii-cli安装完成后,重启终端并验证:
bash
snaplii --helpAlternative: Install with pip
替代方案:使用pip安装
bash
pip install -e ./snaplii-cliIf you get error:
externally-managed-environmentbash
pip install -e ./snaplii-cli --break-system-packagesbash
pip install -e ./snaplii-cli若遇到错误:
externally-managed-environmentbash
pip install -e ./snaplii-cli --break-system-packagesGetting Your API Key
获取API密钥
- Download and open the Snaplii mobile app
- Register an account and bind a payment method to load Snaplii Cash
- Navigate to: More → Payment Methods → AI Payment Management
- Tap + New API Key
- Set a name, permission scope (Read-only or Purchase), and spending limit
- Copy the API key (format: ) — it's shown only once
snp_sk_live_...
Store the key securely in your environment:
bash
export SNAPLII_API_KEY="snp_sk_live_your_key_here"- 下载并打开Snaplii移动应用
- 注册账号并绑定支付方式以充值Snaplii Cash
- 导航至:更多 → 支付方式 → AI支付管理
- 点击**+ 新建API密钥**
- 设置名称、权限范围(只读或可消费)以及消费限额
- 复制API密钥(格式:)—— 密钥仅显示一次
snp_sk_live_...
将密钥安全存储到环境变量中:
bash
export SNAPLII_API_KEY="snp_sk_live_your_key_here"Authentication
身份验证
Authenticate the CLI with your API key:
bash
snaplii initThe CLI will prompt for your API key via hidden input (like a password). The key is used only to obtain a session token and is never stored on disk. Configuration is saved to .
~/.snaplii/config.jsonVerify authentication:
bash
snaplii config show使用API密钥对CLI进行身份验证:
bash
snaplii initCLI会通过隐藏输入(类似密码输入)提示你输入API密钥。密钥仅用于获取会话令牌,绝不会存储在磁盘上。配置信息将保存至。
~/.snaplii/config.json验证身份状态:
bash
snaplii config showKey CLI Commands
核心CLI命令
Browse Available Gift Cards
浏览可用礼品卡
Browse by category (Canada):
bash
snaplii browse tags --prov CABrowse by category (United States):
bash
snaplii browse tags --prov USView specific brand details with denominations and cashback:
bash
snaplii browse brand --id CB_AMAZON_CA按分类浏览(加拿大地区):
bash
snaplii browse tags --prov CA按分类浏览(美国地区):
bash
snaplii browse tags --prov US查看特定品牌的面额和返现详情:
bash
snaplii browse brand --id CB_AMAZON_CAPurchase Gift Cards
购买礼品卡
Purchase a gift card (requires , , and ):
--item-id--price--provbash
undefined购买礼品卡(需指定、和):
--item-id--price--provbash
undefinedOntario, Canada
加拿大安大略省
snaplii purchase --item-id CB_STARBUCKS_CA-CT_DIGITAL --price 25 --prov ON
snaplii purchase --item-id CB_STARBUCKS_CA-CT_DIGITAL --price 25 --prov ON
California, USA
美国加利福尼亚州
snaplii purchase --item-id CB_AMAZON_US-CT_DIGITAL --price 50 --prov CA
**Note on `--prov`:**
- For `browse tags`: use country code (`CA` or `US`)
- For `purchase`: use province/state code (`ON`, `QC`, `BC`, `NY`, `CA`, `TX`, etc.)
**Item ID Format:** `{cardBrandId}-{cardTemplateId}`
Both IDs are available from `snaplii browse brand` output.snaplii purchase --item-id CB_AMAZON_US-CT_DIGITAL --price 50 --prov CA
**关于`--prov`的说明:**
- 使用`snaplii browse tags`时:使用国家代码(`CA`或`US`)
- 使用`snaplii purchase`时:使用省/州代码(`ON`、`QC`、`BC`、`NY`、`CA`、`TX`等)
**Item ID格式:** `{cardBrandId}-{cardTemplateId}`
两个ID均可通过`snaplii browse brand`命令的输出获取。Get Purchase Quote
获取购买报价
Preview price with voucher/cashback before buying:
bash
snaplii quote --item-id CB_AMAZON_CA-CT_DIGITAL --price 100在购买前预览包含优惠券/返现的价格:
bash
snaplii quote --item-id CB_AMAZON_CA-CT_DIGITAL --price 100Manage Gift Cards
管理礼品卡
List all owned gift cards:
bash
snaplii giftcard listView card redemption code and PIN:
bash
snaplii giftcard detail --card-no GC_1234567890列出所有已拥有的礼品卡:
bash
snaplii giftcard list查看礼品卡的兑换码和PIN码:
bash
snaplii giftcard detail --card-no GC_1234567890Smart Features
智能功能
Calculate cashback savings:
bash
snaplii smart cashback --brand-id CB_AMAZON_CA --amount 100View card inventory summary:
bash
snaplii smart dashboard计算返现节省金额:
bash
snaplii smart cashback --brand-id CB_AMAZON_CA --amount 100查看礼品卡库存汇总:
bash
snaplii smart dashboardPython Code Examples
Python代码示例
Using the CLI from Python
在Python中调用CLI
python
import subprocess
import json
import ospython
import subprocess
import json
import osSet API key in environment
在环境变量中设置API密钥
os.environ['SNAPLII_API_KEY'] = 'snp_sk_live_...'
os.environ['SNAPLII_API_KEY'] = 'snp_sk_live_...'
Browse available tags
浏览可用分类
result = subprocess.run(
['snaplii', 'browse', 'tags', '--prov', 'CA'],
capture_output=True,
text=True
)
print(result.stdout)
result = subprocess.run(
['snaplii', 'browse', 'tags', '--prov', 'CA'],
capture_output=True,
text=True
)
print(result.stdout)
Purchase a gift card
购买礼品卡
purchase = subprocess.run(
[
'snaplii', 'purchase',
'--item-id', 'CB_AMAZON_CA-CT_DIGITAL',
'--price', '50',
'--prov', 'ON'
],
capture_output=True,
text=True
)
print(purchase.stdout)
purchase = subprocess.run(
[
'snaplii', 'purchase',
'--item-id', 'CB_AMAZON_CA-CT_DIGITAL',
'--price', '50',
'--prov', 'ON'
],
capture_output=True,
text=True
)
print(purchase.stdout)
List owned cards
列出已拥有的礼品卡
cards = subprocess.run(
['snaplii', 'giftcard', 'list'],
capture_output=True,
text=True
)
print(cards.stdout)
undefinedcards = subprocess.run(
['snaplii', 'giftcard', 'list'],
capture_output=True,
text=True
)
print(cards.stdout)
undefinedAutomated Gift Card Purchase Flow
自动化礼品卡购买流程
python
import subprocess
import json
def get_quote(item_id, price):
"""Get purchase quote with cashback calculation."""
result = subprocess.run(
['snaplii', 'quote', '--item-id', item_id, '--price', str(price)],
capture_output=True,
text=True
)
return result.stdout
def purchase_card(item_id, price, province):
"""Purchase a gift card and return card details."""
result = subprocess.run(
[
'snaplii', 'purchase',
'--item-id', item_id,
'--price', str(price),
'--prov', province
],
capture_output=True,
text=True
)
if result.returncode == 0:
print(f"✓ Successfully purchased {item_id}")
return result.stdout
else:
print(f"✗ Purchase failed: {result.stderr}")
return None
def get_card_details(card_no):
"""Retrieve redemption code and PIN for a card."""
result = subprocess.run(
['snaplii', 'giftcard', 'detail', '--card-no', card_no],
capture_output=True,
text=True
)
return result.stdoutpython
import subprocess
import json
def get_quote(item_id, price):
"""获取包含返现计算的购买报价。"""
result = subprocess.run(
['snaplii', 'quote', '--item-id', item_id, '--price', str(price)],
capture_output=True,
text=True
)
return result.stdout
def purchase_card(item_id, price, province):
"""购买礼品卡并返回卡片详情。"""
result = subprocess.run(
[
'snaplii', 'purchase',
'--item-id', item_id,
'--price', str(price),
'--prov', province
],
capture_output=True,
text=True
)
if result.returncode == 0:
print(f"✓ 成功购买 {item_id}")
return result.stdout
else:
print(f"✗ 购买失败:{result.stderr}")
return None
def get_card_details(card_no):
"""获取礼品卡的兑换码和PIN码。"""
result = subprocess.run(
['snaplii', 'giftcard', 'detail', '--card-no', card_no],
capture_output=True,
text=True
)
return result.stdoutExample workflow
示例工作流
item_id = 'CB_STARBUCKS_CA-CT_DIGITAL'
quote = get_quote(item_id, 25)
print("Quote:", quote)
purchase = purchase_card(item_id, 25, 'ON')
if purchase:
print(purchase)
undefineditem_id = 'CB_STARBUCKS_CA-CT_DIGITAL'
quote = get_quote(item_id, 25)
print("报价:", quote)
purchase = purchase_card(item_id, 25, 'ON')
if purchase:
print(purchase)
undefinedCheck Available Balance and Inventory
查看可用余额和库存
python
import subprocess
def check_dashboard():
"""View card inventory summary."""
result = subprocess.run(
['snaplii', 'smart', 'dashboard'],
capture_output=True,
text=True
)
print(result.stdout)
def calculate_savings(brand_id, amount):
"""Calculate potential cashback savings."""
result = subprocess.run(
[
'snaplii', 'smart', 'cashback',
'--brand-id', brand_id,
'--amount', str(amount)
],
capture_output=True,
text=True
)
print(result.stdout)
check_dashboard()
calculate_savings('CB_AMAZON_CA', 100)python
import subprocess
def check_dashboard():
"""查看礼品卡库存汇总。"""
result = subprocess.run(
['snaplii', 'smart', 'dashboard'],
capture_output=True,
text=True
)
print(result.stdout)
def calculate_savings(brand_id, amount):
"""计算潜在的返现节省金额。"""
result = subprocess.run(
[
'snaplii', 'smart', 'cashback',
'--brand-id', brand_id,
'--amount', str(amount)
],
capture_output=True,
text=True
)
print(result.stdout)
check_dashboard()
calculate_savings('CB_AMAZON_CA', 100)Claude Desktop MCP Server Setup
Claude Desktop MCP服务器设置
The MCP (Model Context Protocol) server allows Claude Desktop to make Snaplii purchases through natural conversation.
MCP(Model Context Protocol)服务器允许Claude Desktop通过自然对话完成Snaplii支付操作。
Install MCP Dependencies
安装MCP依赖
bash
pip install -e ./snaplii-cli
pip install "mcp[cli]"If you get error:
externally-managed-environmentbash
pip install -e ./snaplii-cli --break-system-packages
pip install "mcp[cli]" --break-system-packagesbash
pip install -e ./snaplii-cli
pip install "mcp[cli]"若遇到错误:
externally-managed-environmentbash
pip install -e ./snaplii-cli --break-system-packages
pip install "mcp[cli]" --break-system-packagesAuthenticate
身份验证
bash
snaplii initbash
snaplii initConfigure Claude Desktop
配置Claude Desktop
Edit the Claude Desktop config file:
| OS | Config Location |
|---|---|
| macOS | |
| Windows | |
| Linux | |
Add this configuration (use absolute paths):
json
{
"mcpServers": {
"snaplii": {
"command": "/absolute/path/to/python3",
"args": ["/absolute/path/to/agent-to-merchant-payments/mcp-server/server.py"]
}
}
}Find your Python path:
bash
which python3On Windows:
powershell
where.exe python3编辑Claude Desktop配置文件:
| 操作系统 | 配置文件位置 |
|---|---|
| macOS | |
| Windows | |
| Linux | |
添加以下配置(使用绝对路径):
json
{
"mcpServers": {
"snaplii": {
"command": "/absolute/path/to/python3",
"args": ["/absolute/path/to/agent-to-merchant-payments/mcp-server/server.py"]
}
}
}查找Python路径:
bash
which python3Windows系统:
powershell
where.exe python3Restart Claude Desktop
重启Claude Desktop
Fully quit Claude Desktop (Cmd+Q on macOS) and reopen it.
完全退出Claude Desktop(macOS系统按Cmd+Q)后重新打开。
Verify in Claude
在Claude中验证
Ask Claude:
What gift cards are available on Snaplii?Claude should automatically call and display categories.
snaplii_browse_tags向Claude提问:
Snaplii上有哪些可用的礼品卡?Claude应自动调用并显示分类信息。
snaplii_browse_tagsClaude Code Skill Setup
Claude Code Skill设置
For Claude Code, install the skill definition:
bash
mkdir -p ~/.claude/skills/snaplii-cli
cp skills/snaplii-cli.md ~/.claude/skills/snaplii-cli/SKILL.mdEdit and update the PATH line if needed:
~/.claude/skills/snaplii-cli/SKILL.mdbash
which snapliiReplace the path in the skill file with the directory containing your binary. If is already on your PATH, you can remove the prefix entirely.
snapliisnapliiexport PATH=...针对Claude Code,安装Skill定义:
bash
mkdir -p ~/.claude/skills/snaplii-cli
cp skills/snaplii-cli.md ~/.claude/skills/snaplii-cli/SKILL.md编辑,若需要则更新PATH行:
~/.claude/skills/snaplii-cli/SKILL.mdbash
which snaplii将Skill文件中的路径替换为包含二进制文件的目录。若已在你的PATH中,可直接移除前缀。
snapliisnapliiexport PATH=...Common Patterns
常见模式
Agent-Driven Purchase Workflow
Agent驱动的购买工作流
python
import subprocess
class SnapliAgent:
def __init__(self):
self.authenticated = self._check_auth()
def _check_auth(self):
"""Verify authentication status."""
result = subprocess.run(
['snaplii', 'config', 'show'],
capture_output=True,
text=True
)
return 'authenticated' in result.stdout.lower()
def browse_brands(self, country='CA'):
"""Browse available gift card brands."""
result = subprocess.run(
['snaplii', 'browse', 'tags', '--prov', country],
capture_output=True,
text=True
)
return result.stdout
def get_brand_details(self, brand_id):
"""Get denominations and cashback for a brand."""
result = subprocess.run(
['snaplii', 'browse', 'brand', '--id', brand_id],
capture_output=True,
text=True
)
return result.stdout
def make_purchase(self, item_id, price, province):
"""Execute a gift card purchase."""
if not self.authenticated:
raise Exception("Not authenticated. Run 'snaplii init' first.")
result = subprocess.run(
[
'snaplii', 'purchase',
'--item-id', item_id,
'--price', str(price),
'--prov', province
],
capture_output=True,
text=True
)
if result.returncode != 0:
raise Exception(f"Purchase failed: {result.stderr}")
return result.stdout
def list_inventory(self):
"""List all owned gift cards."""
result = subprocess.run(
['snaplii', 'giftcard', 'list'],
capture_output=True,
text=True
)
return result.stdoutpython
import subprocess
class SnapliAgent:
def __init__(self):
self.authenticated = self._check_auth()
def _check_auth(self):
"""验证身份验证状态。"""
result = subprocess.run(
['snaplii', 'config', 'show'],
capture_output=True,
text=True
)
return 'authenticated' in result.stdout.lower()
def browse_brands(self, country='CA'):
"""浏览可用礼品卡品牌。"""
result = subprocess.run(
['snaplii', 'browse', 'tags', '--prov', country],
capture_output=True,
text=True
)
return result.stdout
def get_brand_details(self, brand_id):
"""获取品牌的面额和返现信息。"""
result = subprocess.run(
['snaplii', 'browse', 'brand', '--id', brand_id],
capture_output=True,
text=True
)
return result.stdout
def make_purchase(self, item_id, price, province):
"""执行礼品卡购买操作。"""
if not self.authenticated:
raise Exception("未完成身份验证,请先运行'snaplii init'。")
result = subprocess.run(
[
'snaplii', 'purchase',
'--item-id', item_id,
'--price', str(price),
'--prov', province
],
capture_output=True,
text=True
)
if result.returncode != 0:
raise Exception(f"购买失败:{result.stderr}")
return result.stdout
def list_inventory(self):
"""列出所有已拥有的礼品卡。"""
result = subprocess.run(
['snaplii', 'giftcard', 'list'],
capture_output=True,
text=True
)
return result.stdoutUsage
使用示例
agent = SnapliAgent()
print(agent.browse_brands('US'))
print(agent.get_brand_details('CB_AMAZON_US'))
purchase_result = agent.make_purchase(
'CB_AMAZON_US-CT_DIGITAL',
50,
'NY'
)
print(purchase_result)
print(agent.list_inventory())
undefinedagent = SnapliAgent()
print(agent.browse_brands('US'))
print(agent.get_brand_details('CB_AMAZON_US'))
purchase_result = agent.make_purchase(
'CB_AMAZON_US-CT_DIGITAL',
50,
'NY'
)
print(purchase_result)
print(agent.list_inventory())
undefinedBulk Purchase with Error Handling
批量购买及错误处理
python
import subprocess
import time
def bulk_purchase(purchases):
"""
Purchase multiple gift cards with retry logic.
purchases: list of dicts with keys: item_id, price, province
"""
results = []
for purchase in purchases:
max_retries = 3
retry_count = 0
while retry_count < max_retries:
try:
result = subprocess.run(
[
'snaplii', 'purchase',
'--item-id', purchase['item_id'],
'--price', str(purchase['price']),
'--prov', purchase['province']
],
capture_output=True,
text=True,
timeout=30
)
if result.returncode == 0:
results.append({
'success': True,
'purchase': purchase,
'output': result.stdout
})
break
else:
retry_count += 1
if retry_count >= max_retries:
results.append({
'success': False,
'purchase': purchase,
'error': result.stderr
})
else:
time.sleep(2 ** retry_count) # Exponential backoff
except subprocess.TimeoutExpired:
retry_count += 1
if retry_count >= max_retries:
results.append({
'success': False,
'purchase': purchase,
'error': 'Timeout after 30 seconds'
})
return resultspython
import subprocess
import time
def bulk_purchase(purchases):
"""
批量购买礼品卡并包含重试逻辑。
purchases: 包含item_id、price、province键的字典列表
"""
results = []
for purchase in purchases:
max_retries = 3
retry_count = 0
while retry_count < max_retries:
try:
result = subprocess.run(
[
'snaplii', 'purchase',
'--item-id', purchase['item_id'],
'--price', str(purchase['price']),
'--prov', purchase['province']
],
capture_output=True,
text=True,
timeout=30
)
if result.returncode == 0:
results.append({
'success': True,
'purchase': purchase,
'output': result.stdout
})
break
else:
retry_count += 1
if retry_count >= max_retries:
results.append({
'success': False,
'purchase': purchase,
'error': result.stderr
})
else:
time.sleep(2 ** retry_count) # 指数退避
except subprocess.TimeoutExpired:
retry_count += 1
if retry_count >= max_retries:
results.append({
'success': False,
'purchase': purchase,
'error': '30秒后超时'
})
return resultsExample usage
使用示例
purchases = [
{'item_id': 'CB_STARBUCKS_CA-CT_DIGITAL', 'price': 25, 'province': 'ON'},
{'item_id': 'CB_AMAZON_CA-CT_DIGITAL', 'price': 50, 'province': 'ON'},
{'item_id': 'CB_WALMART_US-CT_DIGITAL', 'price': 100, 'province': 'NY'}
]
results = bulk_purchase(purchases)
for r in results:
if r['success']:
print(f"✓ {r['purchase']['item_id']}: Success")
else:
print(f"✗ {r['purchase']['item_id']}: {r['error']}")
undefinedpurchases = [
{'item_id': 'CB_STARBUCKS_CA-CT_DIGITAL', 'price': 25, 'province': 'ON'},
{'item_id': 'CB_AMAZON_CA-CT_DIGITAL', 'price': 50, 'province': 'ON'},
{'item_id': 'CB_WALMART_US-CT_DIGITAL', 'price': 100, 'province': 'NY'}
]
results = bulk_purchase(purchases)
for r in results:
if r['success']:
print(f"✓ {r['purchase']['item_id']}: 成功")
else:
print(f"✗ {r['purchase']['item_id']}: {r['error']}")
undefinedConfiguration
配置说明
Configuration is stored in after running .
~/.snaplii/config.jsonsnaplii initConfig structure:
json
{
"agent_id": "derived_from_api_key",
"session_token": "session_token_here",
"token_expiry": "2026-06-01T12:00:00Z"
}Security notes:
- API key is NEVER stored on disk
- Session tokens expire and require re-authentication
- Spending limits and scopes are enforced server-side
View current config:
bash
snaplii config show运行后,配置信息将存储在中。
snaplii init~/.snaplii/config.json配置结构:
json
{
"agent_id": "derived_from_api_key",
"session_token": "session_token_here",
"token_expiry": "2026-06-01T12:00:00Z"
}安全注意事项:
- API密钥绝不会存储在磁盘上
- 会话令牌会过期,需要重新验证身份
- 消费限额和权限范围由服务器端强制执行
查看当前配置:
bash
snaplii config showEnvironment Variables
环境变量
bash
undefinedbash
undefinedSet API key for programmatic access
为程序化访问设置API密钥
export SNAPLII_API_KEY="snp_sk_live_your_key_here"
export SNAPLII_API_KEY="snp_sk_live_your_key_here"
Optional: Set config directory (defaults to ~/.snaplii)
可选:设置配置目录(默认值为~/.snaplii)
export SNAPLII_CONFIG_DIR="/custom/path/to/config"
undefinedexport SNAPLII_CONFIG_DIR="/custom/path/to/config"
undefinedTroubleshooting
故障排除
Command Not Found
命令未找到
If after install:
snaplii: command not foundbash
undefined若安装后出现:
snaplii: command not foundbash
undefinedCheck where it was installed
检查安装位置
python3 -m pip show -f snaplii-cli
Look for `bin/snaplii` or `Scripts\snaplii.exe` in the output. Add that directory to your PATH or use `pipx` instead.python3 -m pip show -f snaplii-cli
在输出中查找`bin/snaplii`或`Scripts\snaplii.exe`。将该目录添加到你的PATH中,或改用`pipx`安装。Module Not Found (MCP Server)
模块未找到(MCP服务器)
If Claude Desktop logs or :
ModuleNotFoundError: No module named 'mcp''snaplii'bash
undefined若Claude Desktop日志显示或:
ModuleNotFoundError: No module named 'mcp''snaplii'bash
undefinedVerify the Python interpreter has required packages
验证Python解释器是否已安装所需包
/absolute/path/to/python -c "import mcp, snaplii; print('ok')"
If it fails, install dependencies to that specific interpreter:
```bash
/absolute/path/to/python -m pip install -e ./snaplii-cli
/absolute/path/to/python -m pip install "mcp[cli]"/absolute/path/to/python -c "import mcp, snaplii; print('ok')"
若验证失败,为该特定解释器安装依赖:
```bash
/absolute/path/to/python -m pip install -e ./snaplii-cli
/absolute/path/to/python -m pip install "mcp[cli]"Externally-Managed Environment
外部管理环境错误
If pip refuses to install globally:
Option 1 (Recommended): Use
pipxbash
pipx install -e ./snaplii-cliOption 2: Use virtual environment
bash
python3 -m venv ~/.venvs/snaplii
source ~/.venvs/snaplii/bin/activate
pip install -e ./snaplii-cliOption 3: Override system protection (use cautiously)
bash
pip install -e ./snaplii-cli --break-system-packages若pip拒绝全局安装:
方案1(推荐): 使用
pipxbash
pipx install -e ./snaplii-cli方案2: 使用虚拟环境
bash
python3 -m venv ~/.venvs/snaplii
source ~/.venvs/snaplii/bin/activate
pip install -e ./snaplii-cli方案3: 覆盖系统保护(谨慎使用)
bash
pip install -e ./snaplii-cli --break-system-packagesAuthentication Issues
身份验证问题
If authentication fails:
- Verify API key format starts with
snp_sk_live_ - Check key permissions in Snaplii mobile app
- Ensure spending limit is not exhausted
- Re-run to refresh session
snaplii init
若身份验证失败:
- 验证API密钥格式是否以开头
snp_sk_live_ - 在Snaplii移动应用中检查密钥权限
- 确保消费限额未耗尽
- 重新运行以刷新会话
snaplii init
Purchase Failures
购买失败
Common causes:
- Insufficient Snaplii Cash balance (load more in mobile app)
- Invalid province/state code (use 2-letter codes: ON, QC, NY, CA, TX)
- Item ID mismatch (verify with )
snaplii browse brand --id <brand_id> - API key lacks permission (check scope in mobile app)
PAY_WRITE
Debug with verbose output:
bash
snaplii purchase --item-id CB_AMAZON_CA-CT_DIGITAL --price 50 --prov ON -v常见原因:
- Snaplii Cash余额不足(在移动应用中充值)
- 省/州代码无效(使用两位代码:ON、QC、NY、CA、TX等)
- Item ID不匹配(通过验证)
snaplii browse brand --id <brand_id> - API密钥缺少权限(在移动应用中检查权限范围)
PAY_WRITE
使用详细输出调试:
bash
snaplii purchase --item-id CB_AMAZON_CA-CT_DIGITAL --price 50 --prov ON -vSecurity Best Practices
安全最佳实践
- Never hardcode API keys — always use environment variables
- Set strict spending limits on each API key in the mobile app
- Use scoped permissions — prefer for browse-only agents
PAY_READ - Rotate keys regularly especially if exposed in logs
- Monitor transactions via the Snaplii mobile app dashboard
- Revoke compromised keys immediately in AI Payment Management
- 切勿硬编码API密钥 — 始终使用环境变量
- 为每个API密钥设置严格的消费限额(在移动应用中配置)
- 使用范围化权限 — 仅浏览的Agent优先选择权限
PAY_READ - 定期轮换密钥,尤其是在日志中暴露后
- 通过Snaplii移动应用仪表盘监控交易
- 若密钥泄露,立即在AI支付管理中撤销
Component Overview
组件概述
agent-to-merchant-payments/
├── snaplii-cli/ # Python CLI (pip-installable)
├── mcp-server/ # MCP server for Claude Desktop
├── skills/ # Claude Code skill definition
├── clawhub-publish/ # ClawHub skill artifact
└── clawhub-plugin/ # ClawHub MCP bundle pluginagent-to-merchant-payments/
├── snaplii-cli/ # Python CLI(可通过pip安装)
├── mcp-server/ # 用于Claude Desktop的MCP服务器
├── skills/ # Claude Code Skill定义
├── clawhub-publish/ # ClawHub Skill制品
└── clawhub-plugin/ # ClawHub MCP捆绑插件Additional Resources
额外资源
License
许可证
Apache License 2.0 — see repository for full license text.
Apache License 2.0 — 详见仓库中的完整许可证文本。