[Daily-Spend-Limits]: Add UTC daily card spending limit contract - #878
[Daily-Spend-Limits]: Add UTC daily card spending limit contract#878DhruvPareek wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
✱ Stainless preview builds for gridThis PR will update the cli kotlin php ruby Edit this comment to update them. They will appear in their respective SDK's changelogs. ⏳ grid-typescript studio⏳ grid-openapi studio⏳ grid-ruby studio⏳ grid-kotlin studio⏳ grid-go studio⏳ grid-python studio⏳ grid-php studio⏳ grid-cli studio⏳ These are partial results; builds are still running. This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
Greptile SummaryThe PR extends the card contract with card- and platform-level UTC daily spending limits, including nullable updates and full Card webhook payloads.
Confidence Score: 4/5The PR should not merge until the daily-limit guide is aligned with the endpoint’s direct BasicAuth request flow. The OpenAPI contract defines PATCH /cards/{id} as a single BasicAuth request returning 200, but the newly added daily-limit example requires credentials from a nonexistent prior 202 signing response. Files Needing Attention: mintlify/snippets/cards/freezing-and-closing.mdx
|
| Filename | Overview |
|---|---|
| openapi/components/schemas/cards/Card.yaml | Adds a required nullable daily-limit field to the canonical Card response shared by card endpoints and webhooks. |
| openapi/components/schemas/cards/CardCreateRequest.yaml | Adds the optional positive maxSpendPerDay issuance input and its UTC-window semantics. |
| openapi/components/schemas/cards/CardUpdateRequest.yaml | Adds nullable set-or-clear semantics for card-specific daily limits. |
| openapi/components/schemas/config/CardConfig.yaml | Adds the platform-wide daily cap and lower-limit precedence contract. |
| openapi/paths/cards/cards_{id}.yaml | Documents direct BasicAuth updates for the new daily-limit field and returns the updated Card with 200. |
| mintlify/snippets/cards/freezing-and-closing.mdx | Adds a daily-limit example that incorrectly requires a signed retry despite the endpoint’s direct BasicAuth contract. |
| openapi/webhooks/card-state-change.yaml | Keeps full Card state-change examples aligned with the newly required daily-limit field. |
| openapi/webhooks/card-funding-source-change.yaml | Keeps the funding-source webhook’s full Card example aligned with the new field. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
CardLimit[Card maxSpendPerDay] --> Effective{Lower configured value}
PlatformLimit[Platform maxSpendPerDay] --> Effective
Effective --> Authorizations[Cumulative new spend]
Authorizations --> Decision{Within effective limit?}
Decision -->|Yes| Approve[Authorization may proceed]
Decision -->|No| Decline[Decline authorization]
Reset[00:00 UTC] --> NewWindow[Start new daily window]
NewWindow --> Authorizations
Refunds[Refunds, reversals, and expiries] -. do not restore capacity .-> Authorizations
Prompt To Fix All With AI
### Issue 1
mintlify/snippets/cards/freezing-and-closing.mdx:160-161
**Daily limit uses wrong flow**
When an integrator follows this new example, it requires a signature and request ID from a prior `202`, but `PATCH /cards/{id}` is a direct BasicAuth operation that returns `200` and never provides that signing payload, so the documented daily-limit update cannot be completed as described.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(cards): add daily spending limit co..." | Re-trigger Greptile
1d1fa05 to
2401764
Compare

Cards can cap individual authorizations but cannot bound cumulative spend across a day. This contract adds card- and platform-level
maxSpendPerDaycontrols with the lower configured value taking precedence.Daily windows reset at 00:00 UTC. Refunds, reversals, and authorization expiries do not restore capacity during the same day, keeping the limit deterministic for integrators.
The card-management guide documents limit updates as direct BasicAuth
PATCH /cards/{id}requests returning200 OK, matching the endpoint contract.Test Plan
make lint-openapi— passed with existing warnings and no errorsgit diff --checkcreated with claude session 4488e661-03aa-4894-8387-647fcee1344e