@stripe/link-cli 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +40 -1
  2. package/dist/cli.js +1295 -524
  3. package/package.json +8 -8
package/README.md CHANGED
@@ -170,6 +170,36 @@ In MCP/agent mode, pass `metadata` as a structured `{ key: value }` object.
170
170
 
171
171
  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"`.
172
172
 
173
+ #### Link Pay Token
174
+
175
+ Some Stripe checkout pages expose an AI-agent steering block that supports a
176
+ Link Pay Token (LPT). Inspect the checkout in a browser before creating the
177
+ SpendRequest: enable the agent checkbox, then verify that both
178
+ `input[name="link_pay_token"]` and
179
+ `data-stripe-merchant-account="acct_..."` are present in the same Stripe
180
+ frame.
181
+
182
+ Create an LPT-bound request with the DOM-derived account ID. Do not pass
183
+ `--merchant-name` or `--merchant-url`; Link resolves the canonical merchant
184
+ identity from the account ID for the approval screen.
185
+
186
+ ```bash
187
+ link-cli spend-request create \
188
+ --payment-method-id csmrpd_xxx \
189
+ --execution-method link_pay_token \
190
+ --merchant-account-id acct_... \
191
+ --context "Purchasing an item from the checkout the agent inspected. The user initiated this purchase through the shopping assistant." \
192
+ --amount 3500 \
193
+ --request-approval
194
+ ```
195
+
196
+ LPT requests use the default `card` credential type and do not support
197
+ `--test`, `--network-id`, or `shared_payment_token`. After approval, retrieve
198
+ `--include link_pay_token` immediately before using it on the same checkout
199
+ surface. Each returned LPT is valid for up to 30 minutes, or until the
200
+ SpendRequest expires. If either DOM marker is absent, create a regular virtual
201
+ card SpendRequest instead; do not create an LPT request.
202
+
173
203
  ### Execute payment
174
204
 
175
205
  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.
@@ -211,6 +241,7 @@ link-cli mpp pay https://climate.stripe.dev/api/contribute \
211
241
  ```bash
212
242
  link-cli auth login --client-name "Claude Code" # identify the connecting agent
213
243
  link-cli auth login --client-name "Claude Code" --interval 5 --timeout 300 # login + poll in one call
244
+ link-cli auth upgrade --scope "userinfo:read spend_requests:approve" # widen access to a superset
214
245
  link-cli auth status # check auth status
215
246
  link-cli auth logout # disconnect
216
247
  ```
@@ -219,6 +250,8 @@ When you provide `--client-name`, the Link app displays it when you approve the
219
250
 
220
251
  With `--interval`, the login command yields the verification code immediately and then polls inline until authenticated or timed out — no separate `auth status` call needed. This is recommended for agents that cannot relay the code while a separate polling command blocks their I/O channel.
221
252
 
253
+ `auth upgrade` takes the same flags as `auth login` but is meant for widening access when you're already logged in. Unlike `auth login` — which stops with an "already logged in" message when a valid session exists — `auth upgrade` merges the flags you pass with your currently granted `scope` and `authorization_details` and starts a new approval for the **superset**, so you never accidentally drop access. If there's no valid session, it prints a warning and continues with just the access you requested. Your current session stays valid throughout the approval and is only replaced (and the old grant revoked) once you approve the new one — so abandoning the approval leaves your existing session untouched.
254
+
222
255
  `auth status` reports the `scope` and `authorization_details` the current session was granted (echoed by the token endpoint at login/refresh and stored in the credential file), and includes an `update` field when a newer version is available:
223
256
 
224
257
  ```json
@@ -244,7 +277,13 @@ All commands accept `--auth <path>` to store auth credentials in a specific file
244
277
 
245
278
  A spend request moves through: **create** → **request approval** → **approved** (with credentials).
246
279
 
247
- **Required fields for create:** `merchant_name`, `merchant_url`, `context`, `amount`. `payment_method_id` is optional — if omitted, your default payment method will be used, or the first eligible one if no default is set.
280
+ **Required fields for a regular card create:** `merchant_name`, `merchant_url`,
281
+ `context`, and `amount`. `payment_method_id` is optional — if omitted,
282
+ your default payment method will be used, or the first eligible one if no
283
+ default is set. Shared Payment Token requests instead require `network_id`;
284
+ Link Pay Token requests require `execution_method=link_pay_token` and the
285
+ DOM-derived `merchant_account_id`, and Link supplies their canonical merchant
286
+ identity.
248
287
 
249
288
  **Constraints:** `context` must be at least 100 characters; `amount` must not exceed 500000 (cents); `currency` must be a 3-letter ISO code. The user has 10 minutes from when approval is requested to approve. Approved credentials (card or SPT) are valid for 12 hours from spend request creation.
250
289
  **Test mode:** Pass `--test` to create a testmode SpendRequest. A testmode SpendRequest will return test payment credentials (e.g test card `4000009990001984`) rather than a real payment credential. Testmode SpendRequests will not charge the underlying payment method of the SpendRequest. This is useful for development and integration testing without real payment methods.