Skip to content

Haoxuanxu/add retrieve approval policy route - #342

Open
haoxuanxu-stripe wants to merge 4 commits into
mainfrom
haoxuanxu/add-retrieve-spending-policy-route
Open

haoxuanxu-stripe wants to merge 4 commits into
mainfrom
haoxuanxu/add-retrieve-spending-policy-route

Conversation

@haoxuanxu-stripe

@haoxuanxu-stripe haoxuanxu-stripe commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

image

Add Approval Policy retrieval support to link-cli and @stripe/link-sdk, aligned with the server contract from [mint#2599662](https://git.corp.stripe.com/stripe-internal/mint/
pull/2599662).

  • Add link-cli approval-policy retrieve
  • Add Link.approvalPolicy.retrieve() to the SDK
  • Call GET /approval-policy
  • Model spend_request_create rules with required per-purchase limits and optional allowed payment methods
  • Surface errors when no policy is configured
  • Update documentation and package changesets
  • Remove the obsolete, unreleased Spending Policy implementation

Response examples

Configured policy:

{
  "rules": [
    {
      "action": "spend_request_create",
      "limits": {
        "per_purchase": {
          "amount": 5000,
          "currency": "usd"
        }
      },
      "allowed_payment_methods": ["balance"]
    }
  ]
}

An explicitly configured empty policy:

{
  "rules": []
}

No configured policy returns HTTP 404:

{
  "error": {
    "message": "No approval policy has been configured",
    "code": "approval_policy_not_found"
  }
}

Motivation

The original implementation targeted the Spending Policy API from mint#2586017. That API was subsequently replaced by Approval Policy, and /spending-policy now intentionally returns
404.

Test plan

  • SDK: 177 tests passing across 16 test files
  • CLI: 424 tests passing across 36 test files
  • SDK and CLI type checks passing
  • SDK and CLI package builds passing
  • Verified root help advertises approval-policy
  • Verified success, unauthenticated, invalid-response, feature-unavailable, and policy-not-configured cases

Rollout/revert plan

The server endpoint is already deployed behind enable_approval_policy_api. This is an unreleased client feature, so no compatibility alias or migration is required. Safe to revert.

@haoxuanxu-stripe
haoxuanxu-stripe requested a review from a team as a code owner September 17, 2026 19:42
@haoxuanxu-stripe
haoxuanxu-stripe force-pushed the haoxuanxu/add-retrieve-spending-policy-route branch from 37b861b to 7e848f7 Compare September 21, 2026 16:24
@haoxuanxu-stripe
haoxuanxu-stripe force-pushed the haoxuanxu/add-retrieve-spending-policy-route branch from 7e848f7 to 7da0945 Compare September 21, 2026 16:32
@haoxuanxu-stripe haoxuanxu-stripe changed the title Haoxuanxu/add retrieve spending policy route Haoxuanxu/add retrieve approval policy route Sep 21, 2026
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.

1 participant