Buy gift cards, mobile top-ups, and eSIMs on Bitrefill. Pay with crypto and x402. 1,500+ brands, 180+ countries
Search, purchase, and deliver digital goods (gift cards, mobile top-ups, eSIMs) via the Bitrefill CLI.
Best payment experiences for instant agentic payments is store credits via balance, then USDC on Base via x402, then Lightning. All the other crypto payments requirse the agent to poll the invoice status to confirm payment.
CLI returns the full list with bitrefill buy-products --help
balance — Instant fulfillment, no on-chain wait. User pre-funds at bitrefill.com. Natural spending cap.usdc_base with x402 — Use --return_payment_link true (default) to get x402_payment_url. An x402-capable agent completes payment autonomously over Base.lightning — Lightning — lightningInvoice, satoshiPriceethereum — Ethereum mainnet (ETH) — address, paymentUri, altcoinPriceeth_base — Base (8453), native ETHusdc_base — Base (8453), USDCusdc_arbitrum — Arbitrum (42161), USDCusdc_polygon — Polygon (137), USDCusdc_erc20 — Ethereum (1), USDCusdc_solana — Solana, USDCusdt_polygon — Polygon (137), USDTusdt_erc20 — Ethereum (1), USDT--return_payment_link true option.This skill enables real-money transactions. Purchases are fulfilled instantly after payment is confirmed.
buy-products. Autonomous purchasing only when the user explicitly opts in for the current session.invoice_id, product, amount, payment method.npm install -g @bitrefill/cli
From source: git clone https://github.com/bitrefill/cli.git && cd cli && pnpm install && pnpm build && npm link
Generate an API key at bitrefill.com/account/developers:
export BITREFILL_API_KEY=YOUR_API_KEY
Alternative: run any command without an API key to trigger browser-based OAuth. Token stored at ~/.config/bitrefill-cli/api.bitrefill.com.json. Clear with bitrefill logout.
| Variable | Purpose |
|---|---|
BITREFILL_API_KEY | Headless auth (skips OAuth) |
search-products → get-product-details → buy-products → get-invoice-by-id / list-orders
bitrefill search-products --query "Netflix" --country US
bitrefill search-products --query "eSIM" --product_type esim --country IT
bitrefill search-products --query "*" --category games
--country must be uppercase Alpha-2 ISO (US, IT, BR). --product_type: giftcard or esim (singular).
Discovering categories: Search with --query "*" — the response includes a categories array with slugs and counts (e.g. food, games, streaming). Add --country to see categories available in a specific country. Use these slugs as --category values.
bitrefill get-product-details --product_id "steam-usa"
Returns a packages array. Each entry has a package_value — use this as package_id in buy-products.
Ignore compound keys like steam-usa<&>5 — use only the value after <&>.
Three denomination types:
5, 50, 200 (pass as number)"1 Month", "12 Months" (exact string, case-sensitive)"1GB, 7 Days", "PUBG New State 300 NC" (exact string, case-sensitive)Only values from get-product-details are accepted — arbitrary amounts are rejected.
--cart_items must be a JSON array [...], even for a single item.
# Numeric
bitrefill buy-products \
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]' \
--payment_method usdc_base
# Duration
bitrefill buy-products \
--cart_items '[{"product_id": "spotify-usa", "package_id": "1 Month"}]' \
--payment_method balance
# Named (eSIM)
bitrefill buy-products \
--cart_items '[{"product_id": "bitrefill-esim-europe", "package_id": "1GB, 7 Days"}]' \
--payment_method usdc_base
Response includes invoice_id, payment_link, and x402_payment_url.
Max 15 items per call.
bitrefill get-invoice-by-id --invoice_id "UUID"
bitrefill list-orders --include_redemption_info true
cart_items must be array, not object:
# WRONG
--cart_items '{"product_id": "steam-usa", "package_id": 5}'
# RIGHT
--cart_items '[{"product_id": "steam-usa", "package_id": 5}]'
Use package_value after <&>, not the compound key:
# WRONG: "steam-usa<&>5" → RIGHT: 5
Named/duration package_id must be exact, case-sensitive:
# WRONG: "1GB" → RIGHT: "1GB, 7 Days"
# WRONG: "300 nc" → RIGHT: "PUBG New State 300 NC"
Country codes must be uppercase Alpha-2:
# WRONG: us, USA, "United States" → RIGHT: US
Load when needed:
| Reference | Use when |
|---|---|
| commands | Full option tables for any command |
| payment | Payment methods list, x402 protocol, response fields |
| troubleshooting | Errors beyond the critical gotchas above |
ZIP package — ready to use