upgrade-stripe by stripe/ai
npx skills add https://github.com/stripe/ai --skill upgrade-stripe最新的 Stripe API 版本是 2026-02-25.clover - 除非用户指定了不同的目标版本,否则在升级时请使用此版本。
本指南涵盖升级 Stripe API 版本、服务器端 SDK、Stripe.js 和移动端 SDK。
Stripe 使用基于日期的 API 版本(例如 2026-02-25.clover、2025-08-27.basil、2024-12-18.acacia)。您账户的 API 版本决定了请求/响应的行为。
向后兼容的变更(无需代码更新):
破坏性变更(需要代码更新):
请查看 API 更新日志 以了解版本间的所有变更。
详情请参阅 SDK 版本管理。
这些 SDK 提供灵活的版本控制:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
全局配置:
import stripe
stripe.api_version = '2026-02-25.clover'
Stripe.api_version = '2026-02-25.clover'
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-02-25.clover'
});
按请求覆盖:
stripe.Customer.create(
email="customer@example.com",
stripe_version='2026-02-25.clover'
)
这些语言使用与 SDK 发布日期匹配的固定 API 版本。不要为强类型语言设置不同的 API 版本,因为响应对象可能与 SDK 中的强类型不匹配。相反,应更新 SDK 以定位新的 API 版本。
始终在代码中指定您要集成的 API 版本,而不是依赖账户的默认 API 版本:
// 良好做法:显式指定版本
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-02-25.clover'
});
// 避免:依赖账户默认值
const stripe = require('stripe')('sk_test_xxx');
详情请参阅 Stripe.js 版本控制。
Stripe.js 采用常青模型,每半年发布一次主要版本(Acacia、Basil、Clover)。
通过 Script 标签:
<script src="https://js.stripe.com/clover/stripe.js"></script>
通过 npm:
npm install @stripe/stripe-js
主要的 npm 版本对应特定的 Stripe.js 版本。
每个 Stripe.js 版本会自动与其对应的 API 版本配对。例如:
2026-02-25.clover API2024-12-18.acacia API您无法覆盖此关联。
详情请参阅 移动端 SDK 版本控制。
两个平台都遵循语义化版本控制(主版本.次版本.修订号):
新功能和修复仅发布在最新的主版本上。请定期升级以获取改进。
使用不同的模型(0.x.y 模式):
所有移动端 SDK 都与您在后端使用的任何 Stripe API 版本兼容,除非文档另有说明。
npm update stripe、pip install --upgrade stripe)apiVersion 参数Stripe-Version 头信息针对新的 API 版本测试您的集成使用 Stripe-Version 头信息在不更改默认版本的情况下针对新版本测试您的代码:
curl https://api.stripe.com/v1/customers \
-u sk_test_xxx: \
-H "Stripe-Version: 2026-02-25.clover"
或在代码中:
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-02-25.clover' // 使用新版本测试
});
每周安装量
2.1K
仓库
GitHub 星标
1.4K
首次出现
2026 年 1 月 20 日
安全审计
安装于
claude-code2.0K
cursor2.0K
opencode2.0K
codex2.0K
gemini-cli2.0K
github-copilot2.0K
The latest Stripe API version is 2026-02-25.clover - use this version when upgrading unless the user specifies a different target version.
This guide covers upgrading Stripe API versions, server-side SDKs, Stripe.js, and mobile SDKs.
Stripe uses date-based API versions (e.g., 2026-02-25.clover, 2025-08-27.basil, 2024-12-18.acacia). Your account’s API version determines request/response behavior.
Backward-Compatible Changes (don’t require code updates):
Breaking Changes (require code updates):
Review the API Changelog for all changes between versions.
See SDK Version Management for details.
These SDKs offer flexible version control:
Global Configuration:
import stripe
stripe.api_version = '2026-02-25.clover'
Stripe.api_version = '2026-02-25.clover'
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-02-25.clover'
});
Per-Request Override:
stripe.Customer.create(
email="customer@example.com",
stripe_version='2026-02-25.clover'
)
These use a fixed API version matching the SDK release date. Don’t set a different API version for strongly-typed languages because response objects might not match the strong types in the SDK. Instead, update the SDK to target a new API version.
Always specify the API version you’re integrating against in your code instead of relying on your account’s default API version:
// Good: Explicit version
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-02-25.clover'
});
// Avoid: Relying on account default
const stripe = require('stripe')('sk_test_xxx');
See Stripe.js Versioning for details.
Stripe.js uses an evergreen model with major releases (Acacia, Basil, Clover) on a biannual basis.
Via Script Tag:
<script src="https://js.stripe.com/clover/stripe.js"></script>
Via npm:
npm install @stripe/stripe-js
Major npm versions correspond to specific Stripe.js versions.
Each Stripe.js version automatically pairs with its corresponding API version. For instance:
2026-02-25.clover API2024-12-18.acacia APIYou can’t override this association.
See Mobile SDK Versioning for details.
Both platforms follow semantic versioning (MAJOR.MINOR.PATCH):
New features and fixes release only on the latest major version. Upgrade regularly to access improvements.
Uses a different model (0.x.y schema):
All mobile SDKs work with any Stripe API version you use on your backend unless documentation specifies otherwise.
npm update stripe, pip install --upgrade stripe)apiVersion parameter in your Stripe client initializationStripe-Version headerUse the Stripe-Version header to test your code against a new version without changing your default:
curl https://api.stripe.com/v1/customers \
-u sk_test_xxx: \
-H "Stripe-Version: 2026-02-25.clover"
Or in code:
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-02-25.clover' // Test with new version
});
Weekly Installs
2.1K
Repository
GitHub Stars
1.4K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
claude-code2.0K
cursor2.0K
opencode2.0K
codex2.0K
gemini-cli2.0K
github-copilot2.0K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装