Stripe API バージョンと SDK のアップグレード ガイド このガイドは、Stripe API(決済サービス用のプログラムインターフェース)のバージョンを新しくする際の手順や注意点をまとめたものです。また、SDK(アプリケーション開発に必要なツール群)のアップグレード方法についても説明します。 使用する際に参考になる情報として、以下が含まれています: - 現在のバージョンから新バージョンへ移行する手順 - アップグレード前に確認すべき互換性(新旧のシステムが問題なく連携すること) - 予期しない動作を防ぐための実装方法 - トラブルシューティング(問題が生じた際の解決方法)とよくある質問 このガイドを参照することで、安全かつ効率的に Stripe サービスの最新版へ移行できます。
Guide for upgrading Stripe API versions and SDKs
このガイドでは、Stripe API(決済APIの仕様)のバージョン、サーバー側SDK(開発ツール一式)、Stripe.js、モバイルSDKのアップグレードについて説明します。
ユーザーがターゲットAPIバージョンを指定した場合はそれを使用します。そうでない場合は、docs.stripe.comでStripe CLIのstripe docs /api/versioningなどのツールを使って現在のバージョンを調べます。APIバージョニングページの「The current version is」で始まる文に記載されています。
バンドル版フォールバックAPIバージョン:2026-08-26.dahlia。この値はこのスキルが最後に生成された2026年9月22日時点のスナップショット(固定点の情報)です。バージョン識別子は YYYY-MM-DD 形式のリリース日で始まり、安定版は毎月リリースされるため、1ヶ月以上前の日付のフォールバックバージョンは古い可能性があります。docs.stripe.comに到達できない場合にのみ使用してください。新しいバージョン番号を推測しないでください。
変更を加える前に、統合が指定するAPIバージョンと比較してください:クライアント設定、リクエスト単位でのオーバーライド、ウェブフック(イベント通知)エンドポイント。ユーザーが明示的に要求しない限り、ピンを古いバージョンに移さず、安定版ピンをプレビュー版に移さないでください。ピンがすでにターゲットと一致する場合は、変更なしとして報告します。選択したターゲットとその情報源を明記してください。ライブ検証に失敗した場合または利用できない場合は、最新バージョンが未検証のままであることを述べ、統合が最新バージョンであると主張しないでください。
明示的なAPIバージョンオーバーライドをサポートするSDKについては、クライアント設定とリクエスト単位のオーバーライドで選択したターゲットを使用します。curlのStripe-Versionテストヘッダーでも使用してください。これらの例に示されているバンドル版APIバージョンをコピーまたは実行する前に、選択したターゲットに置き換えてください。Java、Go、.NETについては、SDKの固定バージョンをオーバーライドするのではなく、選択したAPIバージョンをターゲットとするSDKリリースを選択します。プレビュー版ターゲットには、すべての言語で対応するbetaSDKリリースが必要です。SDKバージョニングを参照してください。
Stripeは日付ベースのAPIバージョン(例:2026-08-26.dahlia、2025-08-27.basil、2024-12-18.acacia)を使用します。アカウントのAPIバージョンはリクエスト/レスポンスの動作を決定します。
後方互換性のある変更(コード更新は不要):
重大な変更(コード更新が必要):
バージョン間のすべての変更はAPIチェンジログを確認してください。
詳細はSDK バージョン管理を参照してください。
これらのSDKは柔軟なバージョン管理を提供します。
グローバル設定:
import stripe
stripe.api_version = '2026-08-26.dahlia'
Stripe.api_version = '2026-08-26.dahlia'
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-08-26.dahlia'
});
リクエスト単位でのオーバーライド:
stripe.Customer.create(
email="customer@example.com",
stripe_version='2026-08-26.dahlia'
)
これらはSDKリリース日に一致する固定APIバージョンを使用します。静的型付け言語のAPIバージョンを異なるものに設定しないでください。レスポンスオブジェクトがSDK内の静的型と一致しない可能性があるためです。代わりに、新しいAPIバージョンをターゲットとするようにSDKを更新してください。
アカウントのデフォルトAPIバージョンに頼らず、統合しているAPIバージョンを常にコードに明示的に指定してください:
// 良い例:明示的なバージョン指定
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-08-26.dahlia'
});
// 避けるべき例:アカウントのデフォルトに依存
const stripe = require('stripe')('sk_test_xxx');
詳細はStripe.js バージョニングを参照してください。
Stripe.jsは常に最新の状態に自動更新されるモデルを使用し、主要リリース(Acacia、Basil、Clover、Dahlia)は2年ごとに行われます。
スクリプトタグ経由:
<script src="https://js.stripe.com/dahlia/stripe.js"></script>
npm経由:
npm install @stripe/stripe-js
npmの主要バージョンは特定のStripe.jsバージョンに対応しています。
各Stripe.jsバージョンは対応するAPIバージョンと自動的にペアリングされます。例えば:
2026-08-26.dahlia APIを使用2024-12-18.acacia APIを使用この関連付けをオーバーライドすることはできません。
詳細はモバイルSDKバージョニングを参照してください。
両プラットフォームはセマンティックバージョニング(MAJOR.MINOR.PATCH)に従います:
新機能と修正は最新メジャーバージョンのみでリリースされます。改善にアクセスするには定期的にアップグレードしてください。
異なるモデル(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-08-26.dahlia"
またはコード内:
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-08-26.dahlia' // 新しいバージョンでテスト
});
This guide covers upgrading Stripe API versions, server-side SDKs, Stripe.js, and mobile SDKs.
If the user specifies a target API version, use it. Otherwise, look up the current version on docs.stripe.com with any documentation or web tool available to you, for example stripe docs /api/versioning with the Stripe CLI. The API versioning page states it in the sentence that begins “The current version is”.
Bundled fallback API version: 2026-08-26.dahlia. This value is only a snapshot from the last time this skill was generated, on 2026-09-22. Version identifiers start with their release date in YYYY-MM-DD format and new stable versions are released monthly, so a fallback version dated more than a month ago is probably stale. Use it only when you can’t reach docs.stripe.com. Never guess about a newer version number.
Before making changes, compare the target with each API version the integration pins: client configuration, per-request overrides, and webhook endpoints. Unless the user explicitly asks for it, don’t move any pin to an older version or a stable pin to a preview version. If a pin already matches the target, report it as unchanged. State the selected target and its source. If live verification fails or is unavailable, say that the latest version remains unverified, and don’t claim the integration is on the latest version.
For SDKs that support explicit API version overrides, use the selected target in client configuration and per-request overrides. Use it in curl Stripe-Version test headers, too. Replace bundled API versions shown in those examples with the selected target before copying or running them. For Java, Go, and .NET, select an SDK release that targets the selected API version instead of overriding the SDK’s fixed version. Preview targets need the matching beta SDK release in every language; see SDK versioning.
Stripe uses date-based API versions (e.g., 2026-08-26.dahlia, 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-08-26.dahlia'
Stripe.api_version = '2026-08-26.dahlia'
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-08-26.dahlia'
});
Per-Request Override:
stripe.Customer.create(
email="customer@example.com",
stripe_version='2026-08-26.dahlia'
)
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-08-26.dahlia'
});
// 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, Dahlia) on a biannual basis.
Via Script Tag:
<script src="https://js.stripe.com/dahlia/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-08-26.dahlia 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-08-26.dahlia"
Or in code:
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-08-26.dahlia' // Test with new version
});
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。