bitrefill-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBitrefill CLI — Real-World Spending for Agents
Bitrefill CLI — 面向Agent的真实场景消费
Agents can't shop on Amazon, book an Airbnb, or pay for a Spotify subscription — traditional e-commerce requires browsers, CAPTCHAs, and credit cards. The Bitrefill CLI bridges this gap: it lets agents autonomously search, purchase, and deliver digital goods (gift cards, mobile top-ups, eSIMs) from 1,500+ brands across 180+ countries, paying with crypto or pre-funded store credits — no human checkout required.
The CLI connects to the Bitrefill MCP server and dynamically discovers available tools, exposing each as a subcommand with typed options. Combined with x402 payments over Base, it enables fully autonomous agent commerce.
Source: github.com/bitrefill/cli
Agent无法在亚马逊购物、预订Airbnb或支付Spotify订阅费用——传统电子商务需要浏览器、验证码和信用卡。Bitrefill CLI填补了这一空白:它允许Agent在180多个国家/地区的1500+品牌中自主搜索、购买和交付数字商品(礼品卡、手机充值、eSIM卡),支持加密货币或预存账户余额支付——无需人工结账。
该CLI连接到Bitrefill MCP服务器,动态发现可用工具,并将每个工具作为带类型选项的子命令暴露出来。结合Base网络上的x402支付,它实现了完全自主的Agent商务。
Security & Autonomous Operation
安全与自主操作
This skill enables real-money transactions. Purchases are fulfilled instantly and are non-refundable once delivered. Agents and operators must understand the requirements and risks before enabling autonomous purchasing.
本技能支持真实货币交易。 购买会即时完成,交付后不可退款。Agent和操作者在启用自主购买功能前,必须了解相关要求和风险。
Required Credentials & Configuration
必要凭证与配置
| Requirement | Location / Variable | Purpose |
|---|---|---|
| Bitrefill OAuth token | | Authenticates CLI requests against the user's Bitrefill account |
| Bitrefill account | bitrefill.com/signup | Required for all operations (search, buy, order history) |
x402-capable wallet (if using | Agent-specific (e.g. signing key, wallet SDK) | Signs and submits on-chain USDC payments on Base |
Pre-funded account balance (if using | Funded at bitrefill.com | Pays for purchases from stored account credits |
| Environment variable | Overrides the default MCP endpoint ( |
| 要求 | 位置 / 变量 | 用途 |
|---|---|---|
| Bitrefill OAuth令牌 | | 验证CLI请求与用户Bitrefill账户的关联 |
| Bitrefill账户 | bitrefill.com/signup | 所有操作(搜索、购买、订单历史)都需要 |
支持x402的钱包(若使用 | Agent专属(如签名密钥、钱包SDK) | 在Base网络上签名并提交链上USDC支付 |
预充值账户余额(若使用 | 在bitrefill.com充值 | 从存储的账户余额中支付购买费用 |
| 环境变量 | 覆盖默认MCP端点( |
Provisioning Credentials for Autonomous Agents
为自主Agent配置凭证
The default OAuth flow opens a browser for interactive authorization — this requires a human for initial setup. For autonomous or headless environments:
- Run the OAuth flow once interactively on a machine with a browser. The CLI stores the token at .
~/.config/bitrefill-cli/api.bitrefill.com.json - Copy the credentials file to the autonomous agent's environment at the same path ().
~/.config/bitrefill-cli/api.bitrefill.com.json - Verify by running — if it returns without prompting for auth, the token is valid.
bitrefill list-orders --limit 1 - Token refresh: If the token expires, repeat step 1. Monitor for auth errors in the agent's logs and re-provision as needed.
Never commit credentials to version control. Addto~/.config/bitrefill-cli/and use secure secret management (e.g. environment-specific vaults, encrypted storage) for deployment..gitignore
默认OAuth流程会打开浏览器进行交互式授权——这需要人工完成初始设置。对于自主或无头环境:
- 在带浏览器的机器上运行一次交互式OAuth流程。CLI会将令牌存储在。
~/.config/bitrefill-cli/api.bitrefill.com.json - 将凭证文件复制到自主Agent环境的相同路径 ()。
~/.config/bitrefill-cli/api.bitrefill.com.json - 验证:运行——如果无需提示授权即可返回结果,说明令牌有效。
bitrefill list-orders --limit 1 - 令牌刷新:如果令牌过期,重复步骤1。监控Agent日志中的授权错误,必要时重新配置。
切勿将凭证提交到版本控制系统。 将添加到~/.config/bitrefill-cli/,并使用安全的密钥管理工具(如环境专属的密码库、加密存储)进行部署。.gitignore
Spending Safeguards
消费安全措施
Agents using this skill must follow these constraints:
- Always confirm with the user before purchasing. Present the product name, denomination, price, and payment method, and wait for explicit approval before calling . Never purchase autonomously without user consent unless the user has explicitly opted into fully autonomous purchasing for the session.
buy-products - Use a dedicated, limited-balance account. For autonomous operation, create a separate Bitrefill account funded with only the amount you're comfortable the agent spending. Do not give agents access to high-balance accounts.
- Prefer over
balancefor autonomous agents. Pre-funded balance has a natural spending cap (the account balance). x402 payments draw from a wallet that may hold more funds than intended for agent use.usdc_base - Never store private keys in plain text. If using x402 payments, the signing wallet's private key must be managed through a secure key management system — not in environment variables, config files, or source code.
- Log all purchases. After every call, log the
buy-products, product, amount, and payment method for audit.invoice_id
使用本技能的Agent 必须遵守以下约束:
- 购买前务必征得用户确认。展示产品名称、面额、价格和支付方式,等待用户明确批准后再调用。除非用户明确选择会话内完全自主购买,否则绝不能未经用户同意自主购买。
buy-products - 使用专用的低余额账户。对于自主操作,创建单独的Bitrefill账户,仅存入你能接受Agent花费的金额。不要让Agent访问高余额账户。
- 自主Agent优先使用而非
balance。预充值余额有天然的消费上限(账户余额)。x402支付会从钱包扣款,该钱包的资金可能远超Agent的预期使用额度。usdc_base - 切勿明文存储私钥。如果使用x402支付,签名钱包的私钥必须通过安全的密钥管理系统管理——不能存储在环境变量、配置文件或源代码中。
- 记录所有购买行为。每次调用后,记录
buy-products、产品、金额和支付方式,以便审计。invoice_id
Prerequisites
前置条件
The CLI must be installed and authenticated before use.
使用前必须安装并验证CLI。
Installation
安装
From NPM (recommended)
从NPM安装(推荐)
bash
npm install -g @bitrefill/clibash
npm install -g @bitrefill/cliFrom Source
从源代码安装
bash
git clone https://github.com/bitrefill/cli.git
cd cli
pnpm install
pnpm build
node dist/index.js # run directlybash
git clone https://github.com/bitrefill/cli.git
cd cli
pnpm install
pnpm build
node dist/index.js # 直接运行or link globally:
或全局链接:
npm link
Dev mode (no build step): `pnpm dev`npm link
开发模式(无需构建步骤):`pnpm dev`Authentication
身份验证
Requires a Bitrefill account. Sign up at bitrefill.com/signup.
On first run, the CLI opens your browser for OAuth authorization. Credentials are stored in .
~/.config/bitrefill-cli/bash
undefined需要Bitrefill账户。在bitrefill.com/signup注册。
首次运行时,CLI会打开浏览器进行OAuth授权。凭证存储在。
~/.config/bitrefill-cli/bash
undefinedFirst command triggers OAuth flow automatically
首次命令会自动触发OAuth流程
bitrefill search-products --query "Netflix"
bitrefill search-products --query "Netflix"
Clear stored credentials
清除存储的凭证
bitrefill logout
After logout, the next command triggers re-authentication automatically.bitrefill logout
注销后,下一次命令会自动触发重新验证。Environment
环境变量
| Variable | Purpose | Default |
|---|---|---|
| Override MCP server endpoint | |
| 变量 | 用途 | 默认值 |
|---|---|---|
| 覆盖MCP服务器端点 | |
Recommended Payment for Agents
推荐的Agent支付方式
For the best agentic payments experience, prefer these two methods:
- (store credits) — Instant, no on-chain confirmation wait. The user pre-funds their account at bitrefill.com with crypto or card, then purchases via CLI are fulfilled immediately. Suggest this when the user wants zero-friction, instant delivery.
balance - with x402 — Use
usdc_base(default) to get an--return_payment_link true. An x402-capable agent can autonomously complete the payment over Base without human intervention.x402_payment_url
Always suggest or x402 over Base first. Fall back to other payment methods only if the user explicitly requests them.
balance为获得最佳的Agent支付体验,优先选择以下两种方式:
- (账户余额) — 即时到账,无需等待链上确认。用户在bitrefill.com用加密货币或银行卡预充值账户,然后通过CLI完成的购买会立即生效。当用户希望零摩擦、即时交付时,建议使用此方式。
balance - 基于x402的— 使用
usdc_base(默认值)获取--return_payment_link true。支持x402的Agent可在Base网络上自主完成支付,无需人工干预。x402_payment_url
始终优先推荐或Base网络上的x402支付。仅当用户明确要求时,才使用其他支付方式。
balanceCore Workflow
核心工作流程
Discovery → Details → Purchase → Track
search-products → get-product-details → buy-products → get-invoice-by-id / list-orders- Search for a product by keyword, category, or country
- Get details to find available denominations (numeric values)
package_id - Buy by specifying (JSON array) and
cart_itemspayment_method - Track via invoice ID or order listing
发现 → 详情 → 购买 → 追踪
search-products → get-product-details → buy-products → get-invoice-by-id / list-orders- 搜索:通过关键词、类别或国家查找产品
- 获取详情:查找可用面额(数字值)
package_id - 购买:指定(JSON 数组)和
cart_itemspayment_method - 追踪:通过发票ID或订单列表查看状态
Available Commands
可用命令
Commands are discovered dynamically from the MCP server. Run for the current list.
bitrefill --help命令从MCP服务器动态发现。运行获取当前命令列表。
bitrefill --helpsearch-products
search-products
bash
bitrefill search-products --query "Netflix"
bitrefill search-products --query "Amazon" --country US
bitrefill search-products --query "eSIM" --product_type esim --country IT
bitrefill search-products --query "*" --category games
bitrefill search-products --query "*" # all products, default country| Option | Description | Default |
|---|---|---|
| Brand name or | |
| Alpha-2 ISO code (e.g. | |
| | — |
| Category slug (e.g. | — |
| | |
| Page number, 1-indexed. | |
| Results per page, 1–500. | |
bash
bitrefill search-products --query "Netflix"
bitrefill search-products --query "Amazon" --country US
bitrefill search-products --query "eSIM" --product_type esim --country IT
bitrefill search-products --query "*" --category games
bitrefill search-products --query "*" # 所有产品,默认国家| 选项 | 描述 | 默认值 |
|---|---|---|
| 品牌名称或 | |
| 两位ISO国家代码(如 | |
| | — |
| 类别别名(如 | — |
| | |
| 页码,从1开始。 | |
| 每页结果数,1–500。 | |
get-product-details
get-product-details
bash
bitrefill get-product-details --product_id "steam-usa"
bitrefill get-product-details --product_id "steam-usa" --currency USDC| Option | Description | Default |
|---|---|---|
| Product slug from search results (required) | — |
| Pricing currency: | |
| Language code for descriptions | |
Returns a array. Each entry has a — this is what you pass as to . Ignore the compound key (e.g. ) — use only the value after .
packagespackage_valuepackage_idbuy-productssteam-usa<&>5<&>Products use three denomination types:
| Type | Example product | | |
|---|---|---|---|
| Numeric | Steam USD, Amazon, Zalando | | |
| Duration | Spotify, subscriptions | | |
| Named | PUBG, eSIMs | | |
Named/duration values are case-sensitive and must match exactly — partial matches (e.g. instead of ) are rejected. Only values listed by are accepted; arbitrary amounts are not supported.
package_id"1GB""1GB, 7 Days"get-product-detailsbash
bitrefill get-product-details --product_id "steam-usa"
bitrefill get-product-details --product_id "steam-usa" --currency USDC| 选项 | 描述 | 默认值 |
|---|---|---|
| 搜索结果中的产品别名(必填) | — |
| 定价货币: | |
| 描述信息的语言代码 | |
返回数组。每个条目包含——这是你需要传递给的。忽略复合键(如)——仅使用后面的值。
packagespackage_valuebuy-productspackage_idsteam-usa<&>5<&>产品有三种面额类型:
| 类型 | 示例产品 | | 需使用的 |
|---|---|---|---|
| 数字型 | Steam美元礼品卡、亚马逊礼品卡、Zalando礼品卡 | | |
| 时长型 | Spotify订阅、会员服务 | | |
| 命名型 | PUBG游戏道具、eSIM套餐 | | |
命名型/时长型的值区分大小写,必须完全匹配——部分匹配(如用代替)会被拒绝。仅接受返回的值;不支持自定义金额。
package_id"1GB""1GB, 7 Days"get-product-detailsbuy-products
buy-products
--cart_itemsbash
undefined--cart_itemsbash
undefinedNumeric denomination
数字型面额
bitrefill buy-products
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
--payment_method usdc_base
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
--payment_method usdc_base
bitrefill buy-products
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
--payment_method usdc_base
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
--payment_method usdc_base
Named denomination (eSIM data plan)
命名型面额(eSIM流量套餐)
bitrefill buy-products
--cart_items '[{"product_id": "bitrefill-esim-europe", "package_id": "1GB, 7 Days"}]'
--payment_method usdc_base
--cart_items '[{"product_id": "bitrefill-esim-europe", "package_id": "1GB, 7 Days"}]'
--payment_method usdc_base
bitrefill buy-products
--cart_items '[{"product_id": "bitrefill-esim-europe", "package_id": "1GB, 7 Days"}]'
--payment_method usdc_base
--cart_items '[{"product_id": "bitrefill-esim-europe", "package_id": "1GB, 7 Days"}]'
--payment_method usdc_base
Duration denomination (subscription)
时长型面额(订阅服务)
bitrefill buy-products
--cart_items '[{"product_id": "spotify-usa", "package_id": "1 Month"}]'
--payment_method usdc_base
--cart_items '[{"product_id": "spotify-usa", "package_id": "1 Month"}]'
--payment_method usdc_base
bitrefill buy-products
--cart_items '[{"product_id": "spotify-usa", "package_id": "1 Month"}]'
--payment_method usdc_base
--cart_items '[{"product_id": "spotify-usa", "package_id": "1 Month"}]'
--payment_method usdc_base
Multiple items (max 15)
多件商品(最多15件)
bitrefill buy-products
--cart_items '[{"product_id": "steam-usa", "package_id": 10}, {"product_id": "netflix-usa", "package_id": 25}]'
--payment_method bitcoin
--cart_items '[{"product_id": "steam-usa", "package_id": 10}, {"product_id": "netflix-usa", "package_id": 25}]'
--payment_method bitcoin
bitrefill buy-products
--cart_items '[{"product_id": "steam-usa", "package_id": 10}, {"product_id": "netflix-usa", "package_id": 25}]'
--payment_method bitcoin
--cart_items '[{"product_id": "steam-usa", "package_id": 10}, {"product_id": "netflix-usa", "package_id": 25}]'
--payment_method bitcoin
Raw crypto details (no payment link)
原始加密货币详情(无支付链接)
bitrefill buy-products
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
--payment_method usdc_base
--return_payment_link false
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
--payment_method usdc_base
--return_payment_link false
| Option | Description | Default |
|--------|-------------|---------|
| `--cart_items` | JSON array of `{product_id, package_id}` objects. 1–15 items. (required) | — |
| `--payment_method` | See payment methods table below. (required) | — |
| `--return_payment_link` | `true` → `payment_link` + `x402_payment_url`. `false` → raw `address`/`paymentUri`. | `true` |
**Response fields (when `return_payment_link true`):**
- `invoice_id` — use with `get-invoice-by-id` to poll status
- `payment_link` — browser checkout URL
- `x402_payment_url` — programmatic x402 payment endpoint
- `payment_info.address` — on-chain destination
- `payment_info.paymentUri` — EIP-681 URI with contract + amount
- `payment_info.altcoinPrice` — amount in payment tokenbitrefill buy-products
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
--payment_method usdc_base
--return_payment_link false
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
--payment_method usdc_base
--return_payment_link false
| 选项 | 描述 | 默认值 |
|--------|-------------|---------|
| `--cart_items` | `{product_id, package_id}`对象的JSON数组。1–15件商品。(必填) | — |
| `--payment_method` | 见下方支付方式表格。(必填) | — |
| `--return_payment_link` | `true` → 返回`payment_link` + `x402_payment_url`。`false` → 返回原始`address`/`paymentUri`。 | `true` |
**响应字段(当`return_payment_link true`时):**
- `invoice_id` — 与`get-invoice-by-id`配合使用,轮询状态
- `payment_link` — 浏览器结账URL
- `x402_payment_url` — 程序化x402支付端点
- `payment_info.address` — 链上收款地址
- `payment_info.paymentUri` — 包含合约和金额的EIP-681 URI
- `payment_info.altcoinPrice` — 支付代币的金额list-invoices
list-invoices
bash
bitrefill list-invoices
bitrefill list-invoices --only_paid false --limit 10
bitrefill list-invoices --after "2026-03-01T00:00:00Z" --before "2026-03-10T00:00:00Z"| Option | Description | Default |
|---|---|---|
| 1–50 | |
| Pagination offset | |
| ISO 8601 date filter | — |
| ISO 8601 date filter | — |
| | |
| Include order details | |
bash
bitrefill list-invoices
bitrefill list-invoices --only_paid false --limit 10
bitrefill list-invoices --after "2026-03-01T00:00:00Z" --before "2026-03-10T00:00:00Z"| 选项 | 描述 | 默认值 |
|---|---|---|
| 1–50 | |
| 分页偏移量 | |
| ISO 8601日期过滤器 | — |
| ISO 8601日期过滤器 | — |
| | |
| 包含订单详情 | |
get-invoice-by-id
get-invoice-by-id
bash
bitrefill get-invoice-by-id --invoice_id "27713c64-6715-48d8-95ef-45eed23efef7"| Option | Description | Default |
|---|---|---|
| UUID of the invoice (required) | — |
| Include order details | |
| Include redemption codes/links | |
| Include unauthenticated access token | |
bash
bitrefill get-invoice-by-id --invoice_id "27713c64-6715-48d8-95ef-45eed23efef7"| 选项 | 描述 | 默认值 |
|---|---|---|
| 发票UUID(必填) | — |
| 包含订单详情 | |
| 包含兑换码/链接 | |
| 包含未验证的访问令牌 | |
list-orders
list-orders
bash
bitrefill list-orders
bitrefill list-orders --limit 5 --include_redemption_info true| Option | Description | Default |
|---|---|---|
| 1–50 | |
| Pagination offset | |
| ISO 8601 date filters | — |
| Include redemption codes/links | |
bash
bitrefill list-orders
bitrefill list-orders --limit 5 --include_redemption_info true| 选项 | 描述 | 默认值 |
|---|---|---|
| 1–50 | |
| 分页偏移量 | |
| ISO 8601日期过滤器 | — |
| 包含兑换码/链接 | |
get-order-by-id
get-order-by-id
bash
bitrefill get-order-by-id --order_id "69af584e8a2639d14ac35e96"Returns redemption code or link if the order is unsealed (paid and delivered).
| Option | Description | Default |
|---|---|---|
| Order ID (required) | — |
| Include redemption codes/links | |
bash
bitrefill get-order-by-id --order_id "69af584e8a2639d14ac35e96"如果订单已解锁(已支付并交付),返回兑换码或链接。
| 选项 | 描述 | 默认值 |
|---|---|---|
| 订单ID(必填) | — |
| 包含兑换码/链接 | |
logout
logout
bash
bitrefill logoutDeletes stored OAuth credentials from .
~/.config/bitrefill-cli/bash
bitrefill logout从删除存储的OAuth凭证。
~/.config/bitrefill-cli/Payment
支付
Payment Methods
支付方式
| Method | Chain / Asset |
|---|---|
| Bitcoin (SegWit) — returns |
| Lightning — returns |
| Ethereum mainnet (ETH) — returns |
| Base (8453), native ETH |
| Base (8453), USDC |
| Arbitrum (42161), USDC |
| Polygon (137), USDC |
| Ethereum (1), USDC |
| Solana, USDC SPL |
| Polygon (137), USDT |
| Ethereum (1), USDT |
| Bitrefill account credit — no address, paid from balance |
| 方式 | 链 / 资产 |
|---|---|
| Bitcoin(SegWit)——返回 |
| Lightning网络——返回 |
| Ethereum主网(ETH)——返回 |
| Base网络(8453),原生ETH |
| Base网络(8453),USDC |
| Arbitrum网络(42161),USDC |
| Polygon网络(137),USDC |
| Ethereum网络(1),USDC |
| Solana网络,USDC SPL代币 |
| Polygon网络(137),USDT |
| Ethereum网络(1),USDT |
| Bitrefill账户余额——无收款地址,从账户余额扣款 |
Response Modes
响应模式
- — raw payment details:
--return_payment_link false,address,amount(+paymentUrifor Bitcoin). For wallet/programmatic pay. NolightningInvoiceorpayment_linkin response.x402_payment_url - (default) — returns
--return_payment_link true(browser checkout) andpayment_link(programmatic pay), plus rawx402_payment_url.payment_info
- — 原始支付详情:
--return_payment_link false,address,amount(+ Bitcoin的paymentUri)。适用于钱包/程序化支付。响应中不包含lightningInvoice或payment_link。x402_payment_url - (默认)——返回
--return_payment_link true(浏览器结账)和payment_link(程序化支付),同时返回原始x402_payment_url。payment_info
x402 Protocol
x402协议
x402 enables HTTP 402-based crypto payments. → receive 402 + payment instructions (Base64 JSON: amount, , networks, timeout) → send crypto → resubmit with proof. For agents/automated tools; humans use .
GET x402_payment_urlpayTopayment_linkx402 基于HTTP 402实现加密货币支付。 → 收到402响应 + 支付指令(Base64编码的JSON:金额、、网络、超时)→ 发送加密货币 → 提交支付凭证。适用于Agent/自动化工具;人类用户使用。
GET x402_payment_urlpayTopayment_linkTroubleshooting
故障排除
cart_items
: expected array, received object
cart_itemscart_items
: expected array, received object
cart_items--cart_items[...]{}bash
undefined--cart_items[...]{}bash
undefinedWRONG — object
错误示例 — 对象格式
--cart_items '{"product_id": "steam-usa", "package_id": 5}'
--cart_items '{"product_id": "steam-usa", "package_id": 5}'
CORRECT — array of objects
正确示例 — 对象数组格式
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
undefined--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
undefinedInvalid denomination
无效面额
The output shows compound IDs like . Do not use the compound key — use only the value after .
get-product-detailssteam-usa<&>5<&>bash
undefinedget-product-detailssteam-usa<&>5<&>bash
undefinedWRONG — compound key
错误示例 — 复合键
--cart_items '[{"product_id": "steam-usa", "package_id": "steam-usa<&>5"}]'
--cart_items '[{"product_id": "steam-usa", "package_id": "steam-usa<&>5"}]'
CORRECT — numeric value
正确示例 — 数值
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
For **named denominations**, use the exact full string. Common mistakes:
```bash--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
对于**命名型面额**,使用完整的精确字符串。常见错误:
```bashWRONG — numeric guess for a named package
错误示例 — 对命名型套餐使用数值猜测
--cart_items '[{"product_id": "spotify-usa", "package_id": 1}]'
--cart_items '[{"product_id": "spotify-usa", "package_id": 1}]'
CORRECT
正确示例
--cart_items '[{"product_id": "spotify-usa", "package_id": "1 Month"}]'
--cart_items '[{"product_id": "spotify-usa", "package_id": "1 Month"}]'
WRONG — partial match
错误示例 — 部分匹配
--cart_items '[{"product_id": "bitrefill-esim-europe", "package_id": "1GB"}]'
--cart_items '[{"product_id": "bitrefill-esim-europe", "package_id": "1GB"}]'
CORRECT
正确示例
--cart_items '[{"product_id": "bitrefill-esim-europe", "package_id": "1GB, 7 Days"}]'
--cart_items '[{"product_id": "bitrefill-esim-europe", "package_id": "1GB, 7 Days"}]'
WRONG — wrong case
错误示例 — 大小写错误
--cart_items '[{"product_id": "pubg-new-state-international", "package_id": "PUBG New State 300 nc"}]'
--cart_items '[{"product_id": "pubg-new-state-international", "package_id": "PUBG New State 300 nc"}]'
CORRECT
正确示例
--cart_items '[{"product_id": "pubg-new-state-international", "package_id": "PUBG New State 300 NC"}]'
Only values listed by `get-product-details` are accepted. Arbitrary amounts (e.g. `7`, `15`, `25`) are rejected.--cart_items '[{"product_id": "pubg-new-state-international", "package_id": "PUBG New State 300 NC"}]'
仅接受`get-product-details`返回的值。自定义金额(如`7`, `15`, `25`)会被拒绝。"Search service is not available" (INTERNAL_ERROR)
"Search service is not available" (INTERNAL_ERROR)
Caused by invalid values:
--country- Lowercase country codes (instead of
us) — silently failsUS - 3-letter codes (instead of
USA) — failsUS - Full names () — fails
United States - Nonexistent codes () — fails
ZZ - Negative page () — fails
--page -1
Fix: always use uppercase Alpha-2 ISO codes (, , , ).
USITBRGB由无效的值导致:
--country- 小写国家代码(如而非
us)——静默失败US - 三位代码(如而非
USA)——失败US - 完整国家名称(如)——失败
United States - 不存在的代码(如)——失败
ZZ - 负数页码(如)——失败
--page -1
解决方法:始终使用大写的两位ISO国家代码(如, , , )。
USITBRGB"Must be one of" errors
"Must be one of" 错误
The CLI validates enum values client-side before sending to the server.
| Option | Valid values | Common mistake |
|---|---|---|
| | |
| | |
CLI会在客户端验证枚举值,再发送到服务器。
| 选项 | 有效值 | 常见错误 |
|---|---|---|
| | |
| | |
Missing required options
缺少必填选项
Omitting or when required exits with: . The CLI enforces required options before connecting to the server.
--cart_items--product_iderror: required option '--<name> <value>' not specified省略必填的或会退出并提示:。CLI会在连接服务器前验证必填选项。
--cart_items--product_iderror: required option '--<name> <value>' not specifiedCart exceeds 15 items
购物车商品超过15件
Maximum 15 items per call. Server rejects with: .
buy-productsToo big: expected array to have <=15 items每次调用最多支持15件商品。服务器会拒绝并提示:。
buy-productsToo big: expected array to have <=15 itemsper_page
exceeds 500
per_pageper_page
超过500
per_pageServer rejects: .
per_page must be less than 500服务器会拒绝并提示:。
per_page must be less than 500Malformed JSON in --cart_items
--cart_items--cart_items
中的JSON格式错误
--cart_itemsNon-JSON strings crash with: . Ensure the value is valid JSON. Shell quoting matters — use single quotes around the JSON, double quotes inside.
Unexpected token ... is not valid JSON非JSON字符串会导致崩溃并提示:。确保值是有效的JSON。Shell引号很重要——对JSON使用单引号,内部使用双引号。
Unexpected token ... is not valid JSONMissing package_id
in cart item
package_id购物车商品缺少package_id
package_idOmitting from a cart item object results in: . Both and are required per item.
package_idInvalid denomination 'undefined'product_idpackage_id购物车商品对象中省略会导致:。每件商品都需要和。
package_idInvalid denomination 'undefined'product_idpackage_idInvoice / Product not found
发票/产品未找到
- with a nonexistent ID:
get-invoice-by-id(RESOURCE_NOT_FOUND)Invoice not found - with a nonexistent
buy-products:product_id(RESOURCE_NOT_FOUND)Product '<slug>' is not available
Verify slugs via and invoice IDs via .
search-productslist-invoices- 使用不存在的ID调用:
get-invoice-by-id(RESOURCE_NOT_FOUND)Invoice not found - 使用不存在的调用
product_id:buy-products(RESOURCE_NOT_FOUND)Product '<slug>' is not available
通过验证产品别名,通过验证发票ID。
search-productslist-invoicesWrong MCP_URL
MCP_URL错误的MCP_URL
MCP_URLSetting to a non-Bitrefill endpoint produces a with the remote server's HTML body. Unset the variable or point it to .
MCP_URLStreamableHTTPErrorhttps://api.bitrefill.com/mcp将设置为非Bitrefill端点会产生,并返回远程服务器的HTML内容。取消设置该变量或指向。
MCP_URLStreamableHTTPErrorhttps://api.bitrefill.com/mcpOAuth / auth failures
OAuth / 身份验证失败
If the CLI hangs or fails on startup:
- Run to clear stale credentials
bitrefill logout - Re-run your command — a fresh OAuth flow will start
- Credentials file:
~/.config/bitrefill-cli/api.bitrefill.com.json
如果CLI在启动时挂起或失败:
- 运行清除过期凭证
bitrefill logout - 重新运行命令——会启动新的OAuth流程
- 凭证文件路径:
~/.config/bitrefill-cli/api.bitrefill.com.json
Empty search results
搜索结果为空
found: 0- The slug doesn't exist (no error, just empty results)
--category - The product is not available in the specified
--country - (default) filters out products that are temporarily out of stock
--in_stock true
Try broadening: remove , change , or set .
--category--country--in_stock falsefound: 0- 别名不存在(无错误,仅返回空结果)
--category - 产品在指定的不可用
--country - (默认)过滤掉了暂时缺货的产品
--in_stock true
尝试扩大搜索范围:移除,更改,或设置。
--category--country--in_stock falseUnpaid invoices
未支付发票
By default shows only paid invoices. To see all (including pending/expired): .
list-invoices--only_paid falseInvoices expire after 180 minutes. If unpaid, create a new one — you cannot re-pay an expired invoice.
默认情况下仅显示已支付发票。要查看所有发票(包括待支付/已过期):使用。
list-invoices--only_paid false发票过期时间为180分钟。如果未支付,需要创建新发票——无法重新支付已过期的发票。