claude-skills/

Anthropic公式スキル・プラグインの日本語ディレクトリ

last sync 22h ago
スキルOfficialdevelopment

📈upgrade-stripe

プラグイン
stripe

説明

Stripe APIのバージョンおよびSDKのアップグレードガイド

原文を表示

Guide for upgrading Stripe API versions and SDKs

ユースケース

  • Stripe APIのバージョンアップグレード時
  • SDKをアップグレードするとき
  • API仕様変更に対応するとき

本文(日本語訳)

最新のStripe APIバージョンは 2026-06-24.dahlia です。 ユーザーが別のターゲットバージョンを指定しない限り、アップグレード時はこのバージョンを使用してください。


Stripeバージョンのアップグレード

このガイドでは、Stripe APIバージョン、サーバーサイドSDK、Stripe.js、およびモバイルSDKのアップグレードについて説明します。


Stripe APIバージョニングの概要

StripeはAPIバージョンに日付ベースの命名を採用しています (例: 2026-06-24.dahlia2025-08-27.basil2024-12-18.acacia)。 アカウントのAPIバージョンによって、リクエスト・レスポンスの挙動が決まります。

変更の種類

後方互換性のある変更(コード修正不要):

  • 新しいAPIリソースの追加
  • 新しいオプションリクエストパラメータの追加
  • 既存レスポンスへの新しいプロパティの追加
  • 不透明な文字列(オブジェクトIDなど)の長さの変更
  • 新しいWebhookイベントタイプの追加

破壊的変更(コード修正が必要):

  • フィールドの名称変更または削除
  • 挙動の変更
  • エンドポイントやパラメータの削除

バージョン間のすべての変更については、API Changelog を参照してください。


サーバーサイドSDKのバージョニング

詳細は SDK Version Management を参照してください。

動的型付け言語(Ruby、Python、PHP、Node.js)

これらのSDKは柔軟なバージョン管理に対応しています。

グローバル設定:

import stripe
stripe.api_version = '2026-06-24.dahlia'
Stripe.api_version = '2026-06-24.dahlia'
const stripe = require('stripe')('sk_test_xxx', {
  apiVersion: '2026-06-24.dahlia'
});

リクエストごとのオーバーライド:

stripe.Customer.create(
  email="customer@example.com",
  stripe_version='2026-06-24.dahlia'
)

静的型付け言語(Java、Go、.NET)

これらのSDKはSDKリリース日に対応した固定のAPIバージョンを使用します。 静的型付け言語では異なるAPIバージョンを設定しないでください。 レスポンスオブジェクトがSDKの強い型定義と一致しなくなる場合があります。 新しいAPIバージョンを対象にする場合は、SDKそのものを更新してください。

ベストプラクティス

アカウントのデフォルトAPIバージョンに依存するのではなく、 コード内で統合対象のAPIバージョンを常に明示的に指定してください。

// 推奨: バージョンを明示
const stripe = require('stripe')('sk_test_xxx', {
  apiVersion: '2026-06-24.dahlia'
});

// 非推奨: アカウントのデフォルトに依存
const stripe = require('stripe')('sk_test_xxx');

Stripe.jsのバージョニング

詳細は Stripe.js Versioning を参照してください。

Stripe.jsはエバーグリーンモデルを採用しており、 メジャーリリース(Acacia、Basil、Clover、Dahlia)を半年ごとに行います。

バージョン指定したStripe.jsの読み込み

scriptタグ経由:

<script src="https://js.stripe.com/dahlia/stripe.js"></script>

npm経由:

npm install @stripe/stripe-js

npmのメジャーバージョンは、特定のStripe.jsバージョンに対応しています。

APIバージョンとの対応

各Stripe.jsバージョンは、対応するAPIバージョンと自動的にペアリングされます。例:

  • Dahlia版 Stripe.js → 2026-06-24.dahlia API を使用
  • Acacia版 Stripe.js → 2024-12-18.acacia API を使用

この対応関係をオーバーライドすることはできません。

v3からの移行

  1. コード内で現在のAPIバージョンを確認する
  2. 関連する変更についてChangelogを確認する
  3. Stripe.jsのバージョンを切り替える前に、APIバージョンを段階的に更新することを検討する
  4. Stripeはv3を無期限にサポートし続けます

モバイルSDKのバージョニング

詳細は Mobile SDK Versioning を参照してください。

iOSおよびAndroid SDK

両プラットフォームともセマンティックバージョニング(MAJOR.MINOR.PATCH)に従います。

  • MAJOR: 破壊的なAPI変更
  • MINOR: 新機能の追加(後方互換性あり)
  • PATCH: バグ修正(後方互換性あり)

新機能と修正は最新のメジャーバージョンにのみリリースされます。 改善内容を利用するために、定期的にアップグレードしてください。

React Native SDK

異なるモデル(0.x.y スキーマ)を採用しています。

  • マイナーバージョンの変更(x): 破壊的変更 および 新機能
  • パッチアップデート(y): 重大なバグ修正のみ

バックエンドとの互換性

ドキュメントに特別な記載がない限り、すべてのモバイルSDKはバックエンドで使用するStripe APIバージョンに関係なく動作します。


アップグレードチェックリスト

  1. 現在のバージョンとターゲットバージョン間の変更について API Changelog を確認する
  2. 移行ガイダンスについて Upgrades Guide を確認する
  3. サーバーサイドSDKのパッケージバージョンを更新する(例: npm update stripepip install --upgrade stripe
  4. Stripeクライアント初期化コード内の apiVersion パラメータを更新する
  5. Stripe-Version ヘッダーを使用して、新しいAPIバージョンに対してインテグレーションをテストする
  6. 新しいイベント構造に対応するようWebhookハンドラを更新する
  7. 必要に応じてStripe.jsのscriptタグまたはnpmパッケージバージョンを更新する
  8. 必要に応じてパッケージマネージャー内のモバイルSDKバージョンを更新する
  9. StripeオブジェクトIDをデータベースに保存する場合は、最大255文字まで格納でき、かつ大文字・小文字を区別する照合順序(case-sensitive collation)に対応したカラムを使用する

APIバージョン変更のテスト

デフォルトバージョンを変更せずに新しいバージョンに対してコードをテストするには、Stripe-Version ヘッダーを使用してください。

curl https://api.stripe.com/v1/customers \
  -u sk_test_xxx: \
  -H "Stripe-Version: 2026-06-24.dahlia"

コードで指定する場合:

const stripe = require('stripe')('sk_test_xxx', {
  apiVersion: '2026-06-24.dahlia'  // 新バージョンでテスト
});

重要事項

  • Webhookリスナーは未知のイベントタイプを適切に処理できるようにしておく
  • アップグレード前に、新しいバージョン構造でWebhookのテストを行う
  • 破壊的変更は影響を受ける製品領域(Payments、Billing、Connectなど)ごとにタグ付けされている
  • 複数のAPIバージョンが同時に共存可能なため、段階的な移行が可能
原文(English)を表示

The latest Stripe API version is 2026-06-24.dahlia - use this version when upgrading unless the user specifies a different target version.

Upgrading Stripe Versions

This guide covers upgrading Stripe API versions, server-side SDKs, Stripe.js, and mobile SDKs.

Understanding Stripe API Versioning

Stripe uses date-based API versions (e.g., 2026-06-24.dahlia, 2025-08-27.basil, 2024-12-18.acacia). Your account’s API version determines request/response behavior.

Types of Changes

Backward-Compatible Changes (don’t require code updates):

  • New API resources
  • New optional request parameters
  • New properties in existing responses
  • Changes to opaque string lengths (e.g., object IDs)
  • New webhook event types

Breaking Changes (require code updates):

  • Field renames or removals
  • Behavioral modifications
  • Removed endpoints or parameters

Review the API Changelog for all changes between versions.

Server-Side SDK Versioning

See SDK Version Management for details.

Dynamically-Typed Languages (Ruby, Python, PHP, Node.js)

These SDKs offer flexible version control:

Global Configuration:

import stripe
stripe.api_version = '2026-06-24.dahlia'
Stripe.api_version = '2026-06-24.dahlia'
const stripe = require('stripe')('sk_test_xxx', {
  apiVersion: '2026-06-24.dahlia'
});

Per-Request Override:

stripe.Customer.create(
  email="customer@example.com",
  stripe_version='2026-06-24.dahlia'
)

Strongly-Typed Languages (Java, Go, .NET)

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.

Best Practice

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-06-24.dahlia'
});

// Avoid: Relying on account default
const stripe = require('stripe')('sk_test_xxx');

Stripe.js Versioning

See Stripe.js Versioning for details.

Stripe.js uses an evergreen model with major releases (Acacia, Basil, Clover, Dahlia) on a biannual basis.

Loading Versioned Stripe.js

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.

API Version Pairing

Each Stripe.js version automatically pairs with its corresponding API version. For instance:

  • Dahlia Stripe.js uses 2026-06-24.dahlia API
  • Acacia Stripe.js uses 2024-12-18.acacia API

You can’t override this association.

Migrating from v3

  1. Identify your current API version in code
  2. Review the changelog for relevant changes
  3. Consider gradually updating your API version before switching Stripe.js versions
  4. Stripe continues supporting v3 indefinitely

Mobile SDK Versioning

See Mobile SDK Versioning for details.

iOS and Android SDKs

Both platforms follow semantic versioning (MAJOR.MINOR.PATCH):

  • MAJOR: Breaking API changes
  • MINOR: New functionality (backward-compatible)
  • PATCH: Bug fixes (backward-compatible)

New features and fixes release only on the latest major version. Upgrade regularly to access improvements.

React Native SDK

Uses a different model (0.x.y schema):

  • Minor version changes (x): Breaking changes AND new features
  • Patch updates (y): Critical bug fixes only

Backend Compatibility

All mobile SDKs work with any Stripe API version you use on your backend unless documentation specifies otherwise.

Upgrade Checklist

  1. Review the API Changelog for changes between your current and target versions
  2. Check Upgrades Guide for migration guidance
  3. Update server-side SDK package version (e.g., npm update stripe, pip install --upgrade stripe)
  4. Update the apiVersion parameter in your Stripe client initialization
  5. Test your integration against the new API version using the Stripe-Version header
  6. Update webhook handlers to handle new event structures
  7. Update Stripe.js script tag or npm package version if needed
  8. Update mobile SDK versions in your package manager if needed
  9. Store Stripe object IDs in databases that accommodate up to 255 characters (case-sensitive collation)

Testing API Version Changes

Use 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-06-24.dahlia"

Or in code:

const stripe = require('stripe')('sk_test_xxx', {
  apiVersion: '2026-06-24.dahlia'  // Test with new version
});

Important Notes

  • Your webhook listener should handle unfamiliar event types gracefully
  • Test webhooks with the new version structure before upgrading
  • Breaking changes are tagged by affected product areas (Payments, Billing, Connect, etc.)
  • Multiple API versions coexist simultaneously, enabling staged adoption

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。