# 混合期間のサブスクリプション さまざまな間隔のアイテムのサブスクリプションを管理します。 1 つのサブスクリプションに価格と請求期間の異なる複数の[サブスクリプション](https://docs.stripe.com/billing/subscriptions/overview.md)アイテムを含めることができ、請求書の生成は Stripe が自動的に処理します。 たとえば、年間の[定額料金](https://docs.stripe.com/products-prices/pricing-models.md#flat-rate)と月額の[使用量ベース手数料](https://docs.stripe.com/billing/subscriptions/usage-based.md)でサービスを提供する場合、両方の価格を同じサブスクリプションの項目として含めることができます。Stripe は、項目レベルの請求期間が一致する場合は単一の統合請求書を生成し、請求期間が異なる場合は別々の請求書を生成します。 > 請求間隔が異なるサブスクリプションでは、[柔軟な課金モード](https://docs.stripe.com/billing/subscriptions/billing-mode.md).を使用する必要があります。ダッシュボードと API で柔軟な請求モードを使用するには、API バージョンを `2025-06-30.basil` 以降にアップグレードする必要があります。 # ダッシュボード > This is a ダッシュボード for when dashboard-or-api is dashboard. View the full page at https://docs.stripe.com/billing/subscriptions/mixed-interval?dashboard-or-api=dashboard. ## 異なる請求間隔を持つサブスクリプションを作成する 1. ダッシュボードの [サブスクリプションページ](https://dashboard.stripe.com/subscriptions?status=active) に移動します。 1. **+サブスクリプションを作成** を選択します。 1. 月次や年次などの請求期間ごとに請求書を発行する商品を追加します。[商品と価格](https://docs.stripe.com/products-prices/manage-prices.md)の管理方法をご確認ください。 1. **サブスクリプション設定**を設定します。 1. **アドバンス設定** セクションまで下にスクロールし、**請求モード** を **柔軟** に設定します。 1. サブスクリプションを作成します。 ## 既存のサブスクリプションに異なる請求間隔を持つアイテムを追加する 1. ダッシュボードの [サブスクリプションページ](https://dashboard.stripe.com/subscriptions?status=active) に移動します。 1. サブスクリプションを見つけ、**+サブスクリプションの更新** をクリックします。 1. **アドバンス設定** セクションまで下にスクロールし、**請求モード** を **柔軟** に設定します。 1. **+サブスクリプションを更新**をクリックします。 1. サブスクリプションを見つけ、**+サブスクリプションの更新**をもう一度クリックします。 1. 間隔の異なるアイテムを追加します。 1. サブスクリプションを作成します。 # API > This is a API for when dashboard-or-api is api. View the full page at https://docs.stripe.com/billing/subscriptions/mixed-interval?dashboard-or-api=api. ## 異なる請求間隔を持つサブスクリプションを作成する [サブスクリプションの作成](https://docs.stripe.com/api/subscriptions/create.md) エンドポイントを呼び出します。次のコードサンプルは、2024 年 1 月 1 日から四半期ごとに 100 米ドル、毎月 15 米ドルを支払う新しいサブスクリプションを作成します: ```curl curl https://api.stripe.com/v1/subscriptions \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d "items[0][price_data][currency]=usd" \ -d "items[0][price_data][product]={{PRODUCT_ID}}" \ -d "items[0][price_data][recurring][interval]=month" \ -d "items[0][price_data][recurring][interval_count]=1" \ -d "items[0][price_data][unit_amount]=1500" \ -d "items[0][quantity]=1" \ -d "items[1][price_data][currency]=usd" \ -d "items[1][price_data][product]={{PRODUCT_ID}}" \ -d "items[1][price_data][recurring][interval]=month" \ -d "items[1][price_data][recurring][interval_count]=3" \ -d "items[1][price_data][unit_amount]=10000" \ -d "items[1][quantity]=1" \ -d collection_method=send_invoice \ -d days_until_due=5 \ -d proration_behavior=none \ -d "billing_mode[type]=flexible" \ -d "expand[0]=latest_invoice" ``` 応答には、最初の請求書 (`latest_invoice`) にアイテムと請求書の両方を含むサブスクリプションが返されます。 ```json { "object": "subscription", "id": "{{SUBSCRIPTION_ID}}", "current_period_start": 1704067200, // Jan 1 2024 "current_period_end": 1706745600, // Feb 1 2024 "items": { "data": [ { "id": "si_A", "price": "price_id_monthly", "current_period_start": 1704067200, // Jan 1 2024 "current_period_end": 1706745600 // Feb 1 2024 }, { "id": "si_B", "price": "price_id_quarterly", "current_period_start": 1704067200, // Jan 1 2024 "current_period_end": 1711929600 // Apr 1 2024 } ], // ... }, "latest_invoice": { "object": "invoice", "id": "in_A", "created": 1704067200, // Jan 1 2024 "period_start": 1704067200, // Jan 1 2024 "period_end": 1704067200, // Jan 1 2024 "lines": { "data": [ { "description": "1 × Monthly Price (at $15.00 / month)", "period": { "start": 1704067200, // Jan 1 2024 "end": 1706745600 // Feb 1 2024 }, // ... }, { "description": "1 × Quarterly Price (at $100.00 every 3 months)", "period": { "start": 1704067200, // Jan 1 2024 "end": 1711929600 // Apr 1 2024 }, // ... } ] }, // ... }, // ... } ``` 2 月 1 日と 3 月 1 日に、サブスクリプションが更新され、月額項目のみの新しいインボイスが生成される。 4 月 1 日に、サブスクリプションの更新で月次と四半期の両方の項目のインボイスが作成されます。 ## 期間が混在するサブスクリプションのスケジュールを作成する サブスクリプションスケジュールを使用して、価格と請求期間が異なるアイテムを使用してサブスクリプションを作成することもできます。 > [Subscription Schedule](https://docs.stripe.com/api/subscription_schedules/create.md) エンドポイントで `duration` を使用することをお勧めします。フェーズの反復カウントを使用するのではなく、サブスクリプションスケジュールのフェーズに時間ベースの期間 (「3 カ月」など) を定義できるため、請求期間が混在するサブスクリプションをより明確にモデル化できます。フェーズの [iterations](https://docs.stripe.com/api/subscription_schedules/create.md#create_subscription_schedule-phases-iterations) は非推奨になりました。 次のコード例では、サブスクリプションの例と同じパラメータを使用して、サブスクリプションスケジュールを作成します。 ```curl curl https://api.stripe.com/v1/subscription_schedules \ -u "<>:" \ -d "customer={{CUSTOMER_ID}}" \ -d start_date=now \ -d "phases[0][items][0][price_data][currency]=usd" \ -d "phases[0][items][0][price_data][product]={{PRODUCT_ID}}" \ -d "phases[0][items][0][price_data][recurring][interval]=month" \ -d "phases[0][items][0][price_data][recurring][interval_count]=1" \ -d "phases[0][items][0][price_data][unit_amount]=1500" \ -d "phases[0][items][0][quantity]=1" \ -d "phases[0][items][1][price_data][currency]=usd" \ -d "phases[0][items][1][price_data][product]={{PRODUCT_ID}}" \ -d "phases[0][items][1][price_data][recurring][interval]=month" \ -d "phases[0][items][1][price_data][recurring][interval_count]=3" \ -d "phases[0][items][1][price_data][unit_amount]=10000" \ -d "phases[0][items][1][quantity]=1" \ -d "phases[0][end_date]=1735718400" \ -d "billing_mode[type]=flexible" \ -d "expand[0]=subscription.latest_invoice" ``` 応答には、最初の請求書 (`latest_invoice`) にアイテムと請求書の両方を含むサブスクリプションが返されます。 ```json { "object": "subscription_schedule", "id": "{{SUBSCRIPTION_SCHEDULE_ID}}", "billing_mode": "flexible", "phases": { "data": [ { "start_date": 1704096000, // Jan 1 2024 "end_date": 1735718400, // Jan 1 2025 "items": [ { "price": "price_id_monthly", // ... }, { "price": "price_id_quarterly", // ... } ] } ] }, "subscription": { "items": { "data": [ { "id": "si_A", "price": "price_id_monthly", "current_period_start": 1704067200, // Jan 1 2024 "current_period_end": 1706745600, // Feb 1 2024 // ... }, { "id": "si_B", "price": "price_id_quarterly", "current_period_start": 1704067200, // Jan 1 2024 "current_period_end": 1711929600, // Apr 1 2024 // ... } ], // ... }, "latest_invoice": { "object": "invoice", "id": "in_A", "created": 1704067200, // Jan 1 2024 "period_start": 1704067200, // Jan 1 2024 "period_end": 1704067200, // Jan 1 2024 "lines": { "data": [ { "description": "1 × Monthly Price (at $15.00 / month)", "period": { "start": 1704067200, // Jan 1 2024 "end": 1706745600 // Feb 1 2024 }, // ... }, { "description": "1 × Quarterly Price (at $100.00 every 3 months)", "period": { "start": 1704067200, // Jan 1 2024 "end": 1711929600 // Apr 1 2024 }, // ... } ] }, // ... }, // ... } } ``` ## サブスクリプションを異なる請求間隔を持つサブスクリプションに更新する 1. サブスクリプションを柔軟な請求書に更新します。 1. [移行エンドポイント](https://docs.stripe.com/api/subscriptions/migrate.md) を呼び出し、既存のサブスクリプションの`billing_mode`を`flexible` に設定します。 1. [サブスクリプションの更新](https://docs.stripe.com/api/subscriptions/update.md)を呼び出し、異なる価格と間隔の項目を追加します。 ## サブスクリプションをキャンセルする 異なる請求間隔を持つサブスクリプションまたはスケジュールをキャンセルすると、それらの期間に関係なく、すべてのサブスクリプションアイテムがキャンセルされます。 サブスクリプションの [督促](https://docs.stripe.com/billing/revenue-recovery/smart-retries.md) の動作は 1 つだけです。決済の再試行がすべて失敗すると、サブスクリプションの 1 つのアイテムのみに関連する請求書の決済が失敗した場合でも、Stripe はサブスクリプション全体をキャンセルし、設定されている督促の設定に応じて、未払いまたは期日経過としてマークします。 [サブスクリプションのキャンセルまたは削除](https://docs.stripe.com/no-code/subscriptions.md#create-subscriptions) の詳細をご確認ください。 ## 混合期間のサブスクリプションの請求期間 各サブスクリプションアイテムには、独自の [current_period_start](https://docs.stripe.com/api/subscriptions/object.md#subscription_object-items-data-current_period_start) と [current_period_end](https://docs.stripe.com/api/subscriptions/object.md#subscription_object-items-data-current_period_end) があります。[サブスクリプションアイテム](https://docs.stripe.com/api/subscription_items/object.md) は、[サブスクリプション](https://docs.stripe.com/api/subscriptions/object.md) リソースの最上位の共有請求期間としてではなく、それぞれの請求期間を直接トラックします。 たとえば、月次、隔月、四半期ごとのアイテムを含むサブスクリプションを 1 月 1 日に作成した場合、次の期間が含まれます。 | | current_period_start | current_period_end | | ---------- | -------------------- | ------------------ | | 月次アイテム | 1 月 1 日 | 2 月 1 日 | | 隔月アイテム | 1 月 1 日 | 3 月 1 日 | | 四半期ごとのアイテム | 1 月 1 日 | 4 月 1 日 | | サブスクリプション | 1 月 1 日 | 2 月 1 日 | 2 月 1 日 (`subscription.current_period_end`) の更新後、サブスクリプションの現在の期間は、すべてのアイテムの最も遅い `current_period_start` と最も早い `current_period_end` に合わせて調整されます。 | | current_period_start | current_period_end | | ---------- | -------------------- | ------------------ | | 月次アイテム | 2 月 1 日 | 3 月 1 日 | | 隔月アイテム | 1 月 1 日 | 3 月 1 日 | | 四半期ごとのアイテム | 1 月 1 日 | 4 月 1 日 | | サブスクリプション | 2 月 1 日 | 3 月 1 日 | 3 回目のサイクル後: | | current_period_start | current_period_end | | ---------- | -------------------- | ------------------ | | 月次アイテム | 3 月 1 日 | 4 月 1 日 | | 隔月アイテム | 3 月 1 日 | 5 月 1 日 | | 四半期ごとのアイテム | 1 月 1 日 | 4 月 1 日 | | サブスクリプション | 3 月 1 日 | 4 月 1 日 | ### 無料トライアル アイテムレベルの請求期間の日付は、通常のサブスクリプションと同様に、無料トライアルの終了日の影響を受けます。サブスクリプションに将来の日付の [trial_end](https://docs.stripe.com/api/subscriptions/object.md#subscription_object-trial_end) が設定されている場合、すべての `current_period_end` の日付 (サブスクリプションとアイテム) も `trial_end` の日付に設定されます。 ### トライアル期間の終了時に一時停止して再開する [trial_settings.end_behavior.missing_payment_method](https://docs.stripe.com/api/subscriptions/object.md#subscription_object-trial_settings-end_behavior-missing_payment_method) (トライアル期間終了後に決済手段が設定されていない場合の挙動を指定する設定) パラメーターを使用して、通常のサブスクリプションと同様に、決済手段が見つからない場合にトライアル終了時に一時停止するように、混合期間サブスクリプションを設定できます。一時停止したサブスクリプションを[再開する](https://docs.stripe.com/billing/subscriptions/trials/free-trials.md?how=api#resume-a-paused-subscription)には、通常のサブスクリプションと同様に、[stripe.subscription.resume](https://docs.stripe.com/api/subscriptions/resume.md) (Stripe サブスクリプションを再開) を使用します。 > `billing_cycle_anchor: 'unchanged'` や `proration_behavior: 'none'` を使って、混合期間のサブスクリプションを再開する場合、各項目の再開日から現在の請求期間の終了までの部分期間の引き落とし比例配分は生成または請求はされません。以下の例を参照してください: 月次項目と隔月項目の混合間隔のサブスクリプションの場合 - `billing_cycle_anchor` = 1 月 1 日 - `trial_end` = 2 月 1 日 - `trial_settings.end_behavior.missing_payment_method` = 「一時停止」 この例では、このサブスクリプションが 2 月 1 日に決済手段の不備により一時停止され、2 月 15 日に `proration_behavior: 'none'` で再開されたと仮定しています。 | | billing_cycle_anchor: ‘unchanged’(請求サイクルの起点:「変更しない」) | billing_cycle_anchor: ‘now’(請求サイクルの起点:「現在」) | | --------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | | 月次アイテム | 項目に設定されている期間: 2 月 1 日から 3 月 1 日 - この期間は請求がないため、新しい請求書は作成されません - 3 月 1 日から 4 月 1 日までの月次項目は、次回 3 月 1 日に請求されます | 項目に設定されている期間: 2 月 15 日から 3 月 15 日 - 2 月 15 日から 3 月 15 日までの月次項目に対して新しい請求書と請求を生成する | | 隔月項目 | 項目に設定されている期間: 2 月 1 日から 4 月 1 日 - この期間は請求がないため、新しい請求書は作成されません - 4 月 1 日から 6 月 1 日までの隔月項目は、次回 4 月 1 日に請求されます | 項目に設定されてる期間: 2 月 15 日から 4 月 15 日 - 2 月 15 日から 4 月 15 日までの月次項目に対して新しい請求書と請求を生成する | | サブスクリプション | - billing_cycle_anchor: 2 月 1 日 - サブスクリプションはすぐにアクティブに移行します | - billing_cycle_anchor の更新が保留されるサブスクリプションの生成: 2 月 15 日 (再開された請求書が支払われたときに適用されます) - 再開請求書が支払われるまで、サブスクリプションは一時停止されたままになります | ### 間隔の調整 異なる請求間隔を持つサブスクリプションでは、すべての項目の価格間隔 (`price.recurring.interval` と `price.recurring.interval_count` の組み合わせ) は、サブスクリプションの最短の価格間隔の倍数である必要があります。一部の価格間隔の組み合わせは、異なる請求間隔を持つサブスクリプションでサポートされていません。 - **サポートされている期間の組み合わせの例**: サブスクリプションの期間が一致していることを検証する際に、Stripe は次の期間を同等と見なします。 - 1 週間と 7 日 - 12 ヶ月と 1 年 - 1 カ月、3 カ月 - 1 カ月、1 年 - 1 日、1 週間 - 1 日、3 カ月 - 1 日、2 年 - 2 週間、4 週間 - 2 カ月、4 カ月、6 カ月 - **サポートされていない期間の組み合わせの例**: 次の価格の[期間](https://docs.stripe.com/api/prices/object.md#price_object-recurring-interval)タイプの間に同等性はありません。 - 週と月 - 週と年 - 日と月 - 日と年 - 2 カ月、3 カ月 - 4 カ月、6 カ月 - 1 週間、1 カ月 - 2 日、1 週間 - 5 カ月、1 年 ## 制限事項 異なる請求間隔を持つサブスクリプションには、次の制限が適用されます。 - The deprecated [cancel_at_period_end](https://docs.stripe.com/api/subscriptions/update.md#update_subscription-cancel_at_period_end) can’t detect which subscription item’s `current_period_end` to use as the cancellation date, so defaults to `min_period_end`. Alternatively: - `cancel_at` パラメータを使用して、将来の日付でサブスクリプションをキャンセルします。 - `min_period_end` または `max_period_end` ヘルパーを使用して、サブスクリプションのキャンセルをトリガーする項目の終了期間を決定します。 - 異なる請求間隔を持つサブスクリプションでは、合計 [繰り返し](https://docs.stripe.com/api/subscription_schedules/create.md#create_subscription_schedule-phases-iterations) を正確に計算できません。代わりに `duration` を使用してサブスクリプションスケジュールを指定してください。 - カスタマーポータルから異なる請求間隔を持つサブスクリプションに顧客維持クーポンを適用することはできません。 - 現在、[Checkout セッション](https://docs.stripe.com/api/checkout/sessions/create.md) で異なる請求間隔を持つサブスクリプションを作成することはできません。