You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+63-38Lines changed: 63 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,13 @@
1
1
# Link CLI
2
2
3
-
Link CLI lets agents get secure, one-time-use payment credentials from a Link wallet — so they can complete purchases on your behalf without ever storing your real card details.
3
+
Link CLI lets agents get secure, one-time-use payment credentials from a Link wallet to complete purchases on your behalf — without storing your real card details.
4
+
5
+
The CLI can produce one of two credential types:
6
+
7
+
- A virtual card (PAN) for use with a standard web checkout form. The issued card works anywhere, and is not restricted to Link-enabled sellers or sellers that use Stripe.
8
+
- A [Shared Payment Token](https://docs.stripe.com/agentic-commerce/concepts/shared-payment-tokens) (SPT) when the seller accepts programmatic payments through [Machine Payment Protocols](https://mpp.dev) (MPP)
9
+
10
+
For now, this is only available to US Link accounts.
4
11
5
12
## Installation
6
13
@@ -14,11 +21,31 @@ Or run directly with `npx`:
14
21
npx @stripe/link-cli
15
22
```
16
23
17
-
You can install the skill via `npx skills add stripe/link-cli`.
24
+
### Use with agents
25
+
26
+
Install the skill:
27
+
28
+
```bash
29
+
npx skills add stripe/link-cli
30
+
```
31
+
32
+
By default when called from an agent (non-TTY), all commands use `toon` output — a compact, LLM-friendly text format. All commands accept `--format [format]` for structured output. Other formats: `json`, `yaml`, `md`, `jsonl`.
33
+
34
+
List available commands:
35
+
36
+
```bash
37
+
link-cli --llms-full
38
+
```
39
+
40
+
Get a command's full schema with `--schema`. Example:
41
+
42
+
```bash
43
+
link-cli spend-request create --schema
44
+
```
18
45
19
-
### MCP Server
46
+
####MCP Server
20
47
21
-
Link CLI can also run as a local MCP server. Add the following to your MCP client config (`.mcp.json`, etc.)
48
+
Link CLI can run as a local MCP server. Add the following to your MCP client config (`.mcp.json`, etc.)
22
49
23
50
```json
24
51
{
@@ -33,6 +60,12 @@ Link CLI can also run as a local MCP server. Add the following to your MCP clien
33
60
34
61
## Quickstart
35
62
63
+
Run a guided onboarding and demo flow:
64
+
65
+
```bash
66
+
link-cli onboard
67
+
```
68
+
36
69
### Login
37
70
38
71
The `link-cli` requires a Link account. You can log in to your existing one or [register online](https://app.link.com).
@@ -41,19 +74,19 @@ The `link-cli` requires a Link account. You can log in to your existing one or [
41
74
link-cli auth login
42
75
```
43
76
44
-
You'll receive a verification URL and a short phrase. Visit the URL, log in to your Link account, and enter the phrase to approve the connection.
77
+
You receive a verification URL and a short phrase. Visit the URL, log in to your Link account, and enter the phrase to approve the connection.
45
78
46
79
### List payment methods
47
80
48
81
```bash
49
82
link-cli payment-methods list
50
83
```
51
84
52
-
Returns the cards and bank accounts saved to your Link account. Use the `id` field as `payment_method_id` in the next step. If you have no payment methods, you can [add new ones in Link](https://app.link.com/wallet).
85
+
Returns the cards and bank accounts saved to your Link account. Use the `id` field as `payment_method_id` in the next step. If you have no payment methods, [add new ones in Link](https://app.link.com/wallet).
53
86
54
87
### Create a spend request
55
88
56
-
To request a secure, one-time payment credential from your Link wallet, you create a spend request. You specify a payment method in your account, as well as some merchant details, line items, and amounts.
89
+
Create a spend request with a payment method, merchant details, line items, and amounts:
@@ -90,21 +123,21 @@ Users can easily approve requests with the [Link app](https://link.com/download)
90
123
91
124
#### Credential types
92
125
93
-
By default, a spend request provisions a virtual card. For merchants that support the [Machine Payments Protocol](https://mpp.dev) (HTTP 402) and the Stripe payment method, you can instead include`--credential-type "shared_payment_token"`.
126
+
By default, a spend request provisions a virtual card. For merchants that support the [Machine Payments Protocol](https://mpp.dev) (HTTP 402) and the Stripe payment method, instead pass`--credential-type "shared_payment_token"`.
94
127
95
128
### Execute payment
96
129
97
130
The approved spend request includes a `card` object with `number`, `cvc`, `exp_month`, `exp_year`, `billing_address`, and `valid_until`. Enter these into the merchant's checkout form.
Polling exits successfully only after the request reaches a terminal status such as `approved`, `denied`, or `expired`. If polling reaches `--timeout` or exhausts `--max-attempts` while the request is still non-terminal, the command exits non-zero with `code: "POLLING_TIMEOUT"` so callers do not treat a still-pending request as complete.
@@ -115,23 +148,22 @@ If the merchant supports MPP, use `link-cli mpp pay` instead:
link-cli auth status --format json # check auth status
129
-
link-cli auth logout--format json # disconnect
159
+
link-cli auth login --client-name "Claude Code"# identify the connecting agent
160
+
link-cli auth status # check auth status
161
+
link-cli auth logout# disconnect
130
162
```
131
163
132
-
When `--client-name` is provided, the name is shown in the Link app when the user approves the connection — e.g.`Claude Code on my-macbook` instead of `link-cli on my-macbook`.
164
+
When you provide `--client-name`, the Link app displays it when you approve the connection — for example,`Claude Code on my-macbook` instead of `link-cli on my-macbook`.
133
165
134
-
`auth status --format json` includes an `update` field when a newer version is available:
166
+
`auth status` includes an `update` field when a newer version is available:
135
167
136
168
```json
137
169
{
@@ -144,7 +176,7 @@ When `--client-name` is provided, the name is shown in the Link app when the use
144
176
}
145
177
```
146
178
147
-
Set `NO_UPDATE_NOTIFIER=1` to suppress update checks (e.g. in CI).
179
+
Set `NO_UPDATE_NOTIFIER=1` to suppress update checks (for example, in CI).
**Required fields for create:**`payment_method_id`, `merchant_name`, `merchant_url`, `context`, `amount`
154
186
155
187
**Constraints:**`context` must be at least 100 characters; `amount` must not exceed 50000 (cents); `currency` must be a 3-letter ISO code.
156
-
**Test mode:** Pass `--test` to create testmode credentials (uses test card `4242424242424242`). Useful for development and integration testing without using real payment methods.
188
+
**Test mode:** Pass `--test` to create testmode credentials (uses test card `4242424242424242`), useful for development and integration testing without real payment methods.
# Retrieve at any time (includes card credentials after approval)
199
+
link-cli spend-request retrieve lsrq_001
169
200
```
170
201
171
-
### Output formats
172
-
173
-
All commands accept `--format json` for structured JSON output. Other formats: `yaml`, `md`, `jsonl`, `toon` (default). Errors are returned as JSON with `code` and `message` fields, with exit code 1.
174
-
175
202
### MPP
176
203
177
-
Use `mpp pay` to complete purchases on merchants that use the [Machine Payments Protocol](https://mpp.dev). The spend request must use `credential_type: "shared_payment_token"` and be approved. The SPT is one-time-use — if payment fails, create a new spend request.
204
+
Use `mpp pay` to complete purchases on merchants that use the [Machine Payments Protocol](https://mpp.dev). The spend request must use `credential_type: "shared_payment_token"` and you must approve it before paying. The SPT is one-time-use — if payment fails, create a new spend request.
0 commit comments