-
Notifications
You must be signed in to change notification settings - Fork 89
Bind Link Pay Tokens to the checkout merchant #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@stripe/link-cli': minor | ||
| --- | ||
|
|
||
| Add merchant-bound Link Pay Token options to spend-request creation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -170,6 +170,36 @@ In MCP/agent mode, pass `metadata` as a structured `{ key: value }` object. | |
|
|
||
| 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"`. | ||
|
|
||
| #### Link Pay Token | ||
|
|
||
| Some Stripe checkout pages expose an AI-agent steering block that supports a | ||
| Link Pay Token (LPT). Inspect the checkout in a browser before creating the | ||
| SpendRequest: enable the agent checkbox, then verify that both | ||
| `input[name="link_pay_token"]` and | ||
| `data-stripe-merchant-account="acct_..."` are present in the same Stripe | ||
| frame. | ||
|
|
||
| Create an LPT-bound request with the DOM-derived account ID. Do not pass | ||
| `--merchant-name` or `--merchant-url`; Link resolves the canonical merchant | ||
| identity from the account ID for the approval screen. | ||
|
|
||
| ```bash | ||
| link-cli spend-request create \ | ||
| --payment-method-id csmrpd_xxx \ | ||
| --execution-method link_pay_token \ | ||
| --merchant-account-id acct_... \ | ||
| --context "Purchasing an item from the checkout the agent inspected. The user initiated this purchase through the shopping assistant." \ | ||
| --amount 3500 \ | ||
| --request-approval | ||
| ``` | ||
|
|
||
| LPT requests use the default `card` credential type and do not support | ||
| `--test`, `--network-id`, or `shared_payment_token`. After approval, retrieve | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, @sylwang-stripe is working on broader support in this area. |
||
| `--include link_pay_token` immediately before using it on the same checkout | ||
| surface. Each returned LPT is valid for up to 30 minutes, or until the | ||
| SpendRequest expires. If either DOM marker is absent, create a regular virtual | ||
| card SpendRequest instead; do not create an LPT request. | ||
|
|
||
| ### Execute payment | ||
|
|
||
| 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. | ||
|
|
@@ -247,7 +277,13 @@ All commands accept `--auth <path>` to store auth credentials in a specific file | |
|
|
||
| A spend request moves through: **create** → **request approval** → **approved** (with credentials). | ||
|
|
||
| **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. | ||
| **Required fields for a regular card create:** `merchant_name`, `merchant_url`, | ||
| `context`, and `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. Shared Payment Token requests instead require `network_id`; | ||
| Link Pay Token requests require `execution_method=link_pay_token` and the | ||
| DOM-derived `merchant_account_id`, and Link supplies their canonical merchant | ||
| identity. | ||
|
|
||
| **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. | ||
| **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. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels like we should consider transitioning to the
--credential-type link_pay_token?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I agree a link_pay_token credential type flow would be cleaner longer term. But let's focus on that in a follow-up?