Skip to content

Add the ability to set extended spend request expiration - #255

Merged
jlau-stripe merged 4 commits into
mainfrom
jlau/spend-request-expires-at
Aug 20, 2026
Merged

Add the ability to set extended spend request expiration#255
jlau-stripe merged 4 commits into
mainfrom
jlau/spend-request-expires-at

Conversation

@jlau-stripe

Copy link
Copy Markdown
Contributor

as titled

jlau-stripe and others added 2 commits August 19, 2026 15:56
Mirrors the mint PR (stripe-internal/mint#2484603) that lets allow-listed
OAuth clients request a spend request expiration up to 7 days out instead
of the default 12 hours, for extended/repeat-use agent scenarios.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Committed-By-Agent: claude
Most OAuth clients aren't allow-listed for the server-side flag; leaving
it documented in SKILL.md/README.md/schema descriptions would prompt
general agents to try it and hit a 400. The flag stays functional
(same as the existing `approve` field) but drops its description so it
no longer shows up meaningfully in --schema/--llms-full.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Committed-By-Agent: claude
.describe(
'Metadata key:value pair (repeatable). Attaches arbitrary string data to the spend request. Max 50 keys, key <= 40 chars, value <= 500 chars. Example: "order_id:ord_123"',
),
expiresAt: z.coerce.number().int().optional().describe(''),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a description? is it seconds since epoch?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're intentionally leaving it undocumented since it's only supported by certain integrations/clients, but will let @jlau-stripe confirm

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup! I intentionally left it undocumented because only specific clients can extend expiration at this moment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but in this specific case I should still describe what the unit is. Will update!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, it'll still show up when they run --help etc., so might as well tell it the right format

@kreese-stripe kreese-stripe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one non-blocking comment

Comment thread CLAUDE.md
- `--approval-detail` — optional JSON object (MCP/agent) or JSON string (CLI) with approval details for delegated flows. Required fields: `approved_at` (unix timestamp int), `approval_method` (`click`|`programmatic`|`voice`), `app_name`, `external_user_id`. Optional: `ip_address`, `user_agent`, `device_type` (`mobile`|`web`), `agent_log_id`, `external_user_name`, `external_session_id`, `authentication_method` (`biometric_face`|`biometric_fingerprint`|`passkey`). Sent as `approval_details` in the API request body.
- `card` credentials include `billing_address` (name, line1, line2, city, state, postal_code, country) and `valid_until` (ISO date string — when the card expires/stops working)
- `--output-file <path>` on `retrieve` or `create` writes full card credentials to a local file (0600 permissions) and redacts card data in stdout. `--force` allows overwriting an existing file.
- `create` also accepts an undocumented `--expires-at <unix_seconds>` to override the default 12-hour spend request expiration (3 hours to 7 days in the future). It's deliberately excluded from `--schema`/`--llms-full` output and from README/SKILL.md: it's gated to an allow-list of OAuth clients server-side, and most callers get a 400 (`"expires_at is not supported for this client"`) if they try it — don't document or suggest it to general agents.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this requires a backend change, but I wonder if we should make this a delta rather than an absolute timestamp - I remember hearing that agents have a hard time generating these timestamps as opposed to specifying something like "5 mins"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it a couple times and don't seem to have issues with this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will keep it as is and update if we run into problem

Bare field with no description gave zero signal, but agents seeing an
undocumented integer field could just as easily guess wrong (e.g.
milliseconds). Clarifying the unit alone doesn't explain the gating or
bounds, so it stays unlikely to be tried speculatively.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Committed-By-Agent: claude
CI was failing pnpm biome check on the line-length wrap for the
one-line describe() call added in 1b6021f.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Committed-By-Agent: claude
@jlau-stripe
jlau-stripe merged commit ea1ed1d into main Aug 20, 2026
5 checks passed
@jlau-stripe
jlau-stripe deleted the jlau/spend-request-expires-at branch August 20, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants