Stripe API バージョンと SDK のアップグレード ガイド このガイドは、Stripe API(決済サービス用のプログラムインターフェース)のバージョンを新しくする際の手順や注意点をまとめたものです。また、SDK(アプリケーション開発に必要なツール群)のアップグレード方法についても説明します。 使用する際に参考になる情報として、以下が含まれています: - 現在のバージョンから新バージョンへ移行する手順 - アップグレード前に確認すべき互換性(新旧のシステムが問題なく連携すること) - 予期しない動作を防ぐための実装方法 - トラブルシューティング(問題が生じた際の解決方法)とよくある質問 このガイドを参照することで、安全かつ効率的に Stripe サービスの最新版へ移行できます。
Guide for upgrading Stripe API versions and SDKs
最新のStripe APIバージョンは 2026-07-29.dahlia です。ユーザーが別のバージョンを指定しない限り、アップグレード時はこのバージョンを使用してください。
このガイドは、Stripe APIバージョン、サーバー側SDK(ソフトウェア開発キット)、Stripe.js、およびモバイルSDKのアップグレード方法を説明します。
Stripeは日付ベースのAPIバージョン(例:2026-07-29.dahlia、2025-08-27.basil、2024-12-18.acacia)を使用しています。あなたのアカウントのAPIバージョンは、リクエストとレスポンスの動作を決定します。
後方互換性のある変更(コードの更新は不要):
互換性を破る変更(コードの更新が必要):
バージョン間のすべての変更については、「APIの変更履歴」をご確認ください。
これらのSDKは柔軟なバージョン制御を提供します。
グローバル設定:
import stripe
stripe.api_version = '2026-07-29.dahlia'
Stripe.api_version = '2026-07-29.dahlia'
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-07-29.dahlia'
});
リクエストごとのオーバーライド:
stripe.Customer.create(
email="customer@example.com",
stripe_version='2026-07-29.dahlia'
)
これらはSDKのリリース日に対応した固定APIバージョンを使用します。型指定の厳密な言語では別のAPIバージョンを設定しないでください。レスポンスオブジェクトがSDK内の型定義と一致しなくなる可能性があるため、代わりに新しいAPIバージョンをターゲットにするようにSDKを更新してください。
アカウントのデフォルトAPIバージョンに頼るのではなく、コード内で統合対象のAPIバージョンを明確に指定してください:
// 推奨: バージョンを明示的に指定
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-07-29.dahlia'
});
// 避けるべき: アカウントのデフォルトに依存
const stripe = require('stripe')('sk_test_xxx');
Stripe.jsは常に最新に保つモデルを採用し、6ヶ月ごとにメジャーリリース(Acacia、Basil、Clover、Dahlia)を行っています。
スクリプトタグ経由:
<script src="https://js.stripe.com/dahlia/stripe.js"></script>
npm経由:
npm install @stripe/stripe-js
npmのメジャーバージョンは特定のStripe.jsバージョンに対応しています。
各Stripe.jsバージョンは、対応するAPIバージョンと自動的にペアになります。例えば:
2026-07-29.dahlia APIを使用2024-12-18.acacia APIを使用この組み合わせは変更できません。
両プラットフォームはセマンティックバージョニング(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-07-29.dahlia"
またはコード内で:
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-07-29.dahlia' // 新しいバージョンでテスト
});
The latest Stripe API version is 2026-07-29.dahlia - 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-07-29.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-07-29.dahlia'
Stripe.api_version = '2026-07-29.dahlia'
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-07-29.dahlia'
});
Per-Request Override:
stripe.Customer.create(
email="customer@example.com",
stripe_version='2026-07-29.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-07-29.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-07-29.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-07-29.dahlia"
Or in code:
const stripe = require('stripe')('sk_test_xxx', {
apiVersion: '2026-07-29.dahlia' // Test with new version
});
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。