stripe-link-cli – skill Lập trình cho agent AI
Thanh toán cho agent qua Stripe Link — thẻ, SPT, phê duyệt.
Cài skill stripe-link-cli bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/stripe-link-cli-32c13.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /stripe-link-cli – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/stripe-link-cli-32c13.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $stripe-link-cli – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/stripe-link-cli-32c13.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /stripe-link-cli – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/stripe-link-cli-32c13.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /stripe-link-cli – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Stripe Link CLI Skill
Wraps [@stripe/link-cli](https://github.com/stripe/link-cli) so Hermes can complete purchases on the user's behalf using one-time-use virtual cards or Shared Payment Tokens (SPT). Every spend is gated by an in-app approval in the Link mobile/web app — Hermes cannot self-approve.
US-only at the moment (Link account requirement). Windows is not supported by the upstream CLI — this skill is gated [linux, macos].
When to Use
Trigger phrases:
- "buy X", "pay for X", "make a purchase", "complete checkout"
- "get me a card", "I need a payment method"
- "log in to Link", "connect my Link wallet"
- HTTP 402 response from a merchant API with
www-authenticate: ... method="stripe"
If the user wants a paid API call (HTTP 402, no checkout form), the card path is wrong — use SPT via this same skill, or hand off to the mpp-agent skill.
Prerequisites
- Node.js 20+ available on
PATH(node --version) - US-based (Link account requirement)
The Link account, payment method, and spend-approval app do NOT need to be set up before Hermes attempts to pay — the CLI walks the user through them on first run:
- A Link account at https://app.link.com — created/linked during first
link-cliauth - At least one payment method — added during first run at https://app.link.com/wallet
- The Link mobile/web app — opened to approve the first spend request when it's made
No env vars required — auth state is stored locally by the CLI under its own config directory.
Install
Install once, globally:
npm install -g @stripe/link-cliOr invoke ad-hoc via npx @stripe/link-cli. The skill below uses the installed link-cli form.
How to Run
All commands run through the terminal tool. The CLI auto-detects non-TTY callers and emits compact toon output by default — fine for the model. Pass --format json if a step needs structured fields.
Discover commands: link-cli --llms-full.
Get a command's schema before invoking: link-cli <command> --schema.
Procedure
1. Check / establish auth
link-cli auth statusIf not authenticated, log in with a clear client name (this label shows in the user's Link app):
link-cli auth login --client-name "Hermes" --interval 5 --timeout 300The --interval/--timeout form polls inline so the agent doesn't need to manage a _next step. Print the verification URL + phrase to the user and wait for the CLI to return.
Do not proceed past this step until auth status confirms login.
2. Evaluate the merchant before creating a spend request
Decide the credential type:
| Merchant surface | --credential-type |
|---|---|
| Standard web checkout form / Stripe Elements | card (default) |
| Returns HTTP 402 with method="stripe" in www-authenticate | shared_payment_token |
| Returns HTTP 402 without method="stripe" | unsupported — stop |
For 402 responses, do NOT decode the challenge manually. Pass the raw header:
link-cli mpp decode --challenge '<full WWW-Authenticate header>'This validates the challenge and extracts the network ID + decoded request body.
3. List payment methods + shipping
link-cli payment-methods list
link-cli shipping-address listUse the first entry unless the user specifies otherwise. The id from payment-methods list is the --payment-method-id in the next step.
4. Create the spend request
Confirm the final total with the user before issuing this command. Amounts are in cents.
link-cli spend-request create \
--payment-method-id <pm_id> \
--merchant-name "<name>" \
--merchant-url "<url>" \
--context "<one sentence: what is being purchased and why>" \
--amount <cents> \
--line-item "name:<item>,unit_amount:<cents>,quantity:1" \
--total "type:total,display_text:Total,amount:<cents>" \
--request-approvalFor MPP merchants add --credential-type shared_payment_token.
--request-approval pings the user's Link app and polls until they approve or deny. The CLI exits non-zero on deny / timeout.
5. Retrieve the credential — SECURELY
Do not print card details to stdout. Use --output-file so the PAN never enters the agent's transcript or logs:
link-cli spend-request retrieve <lsrq_id> \
--include card \
--output-file ~/.hermes/cache/scratch/link-card.json \
--format jsonThe file is written with 0600 perms; stdout shows only redacted fields (brand, last4, expiry) plus a card_output_file path.
6. Use the credential
- For web checkout: hand the file path to the user, OR pass it to a browser-driving tool that fills the form directly from disk. Never
read_fileorcatthe card file into the agent's reasoning context. - For MPP merchants:
link-cli mpp pay <merchant-url> \
--spend-request-id <lsrq_id> \
--method POST \
--data '<json body>'
7. Clean up
Delete the card file as soon as the purchase is done:
rm -f ~/.hermes/cache/scratch/link-card.jsonOptional: run as an MCP server instead
@stripe/link-cli --mcp exposes the same commands as MCP tools over stdio. To register it with Hermes' native MCP:
hermes mcp add stripe-link --command "npx" --args "@stripe/link-cli --mcp"Then hermes mcp list should show stripe-link. The same approval rules apply — MCP doesn't bypass the Link app approval step.
Pitfalls
- US-only. Outside the US,
auth loginwill fail. Tell the user, don't keep retrying. - Card PAN must never enter agent context. Use
--output-fileevery time. If you've already retrieved without it, immediatelylink-cli auth logoutis not enough — the card is one-time-use but rotate hygiene matters. --request-approvalblocks until the user acts. If the user is asleep, the CLI will hit its timeout. Set expectations.- Multi-step
_nextcommands. Some commands return_next.commandthat must be executed to continue. When in doubt, prefer the inline-polling flags (--interval/--timeout). - Output format defaults to
toonin non-TTY mode. Fine for prose, but if a downstream step needs to parse a specific field, pass--format json. - Don't default to
card. The merchant-evaluation step (Section 2) exists because picking the wrong credential type fails the purchase silently or leaks more data than needed.
Verification
link-cli --version && link-cli auth statusExit code 0 means installed and logged in.
Skill liên quan
- torchdrug – Xây dựng và khắc phục sự cố quy trình TorchDrug 0.2.1 cho đồ thị phân tử, dự đoán thuộc…
- ebpf-observability – Dùng eBPF để quan sát sâu ở mức kernel — theo dõi syscall, luồng mạng và hành vi ứng…
- edr-bypass-re – Xem xét telemetry EDR và các nhóm kỹ thuật né tránh phòng thủ đã biết, dùng bằng chứng…
- pw – Bộ công cụ kiểm thử Playwright chuẩn production. Dùng khi người dùng nhắc đến test…
- pw-init – Thiết lập Playwright trong dự án. Dùng khi người dùng nói “thiết lập playwright”, “thêm…
- electron-development – Làm chủ phát triển ứng dụng desktop Electron với IPC an toàn, contextIsolation, preload…
- elixir – Hướng dẫn mã nguồn chuyên biệt cho Elixir.
- track-management – Dùng skill này khi tạo, quản lý hoặc làm việc với track Conductor — đơn vị công việc…