サブスクリプションの注文修正
サブスクリプションの注文の修正を作成する方法をご紹介します。
The Stripe Billing app for Salesforce CPQ creates a subscription schedule in Stripe for every Salesforce order that’s synced with a subscription type. To modify an existing order, you create an order amendment. An order amendment in Salesforce results in a new subscription schedule phase on an existing subscription schedule in Stripe.
ユースケースに応じて、以下のいずれかの修正タイプを作成しなければならない場合があります。
挿入注文修正
To adjust or partially cancel an activated order mid-cycle, you use an insertion order amendment. The app updates the subscription schedule in Stripe with the new products and quantity of the order amendment in Salesforce. The app uses the same mapping as the initial order integration.
開始日と終了日
注文修正では、開始日と終了日の間にギャップがあってはなりません。エラーが生じないようにするために、注文修正の開始日は以下のようにする必要があります。
- 前の注文または注文修正の終了日以前にする
- または、以前の初回の注文または注文修正と同じ開始日にする
注文修正はすべて、最初の注文と同時に終了する必要があります。Salesforce CPQ は、契約の開始日とサブスクリプション期間を組み合わせて終了日の計算に使用します。このため、すべての注文修正の終了日を同一にする必要があります (開始日 + サブスクリプション期間)。
注文の差分
An order amendment includes only the delta from the previous order. The app pulls all previous orders and aggregates all previous line items to determine what subscription items to include in the new subscription schedule phase. Stripe doesn’t reuse or connect the items from one phase of a subscription to items from a previous phase.
注文の契約
Stripe でサブスクリプションを変更するには、注文および注文修正を同じ契約に関連付ける必要があります。Salesforce CPQ は、契約された注文および注文修正ごとにこれを自動的に行います。
Salesforce CPQ の注文から契約することをお勧めします。 Stripe に Salesforce の Contract
オブジェクトを直接表す表記はありません。
アイテムの価格
注文アイテムの価格が変更されない限り、Stripe は同じ Price
オブジェクトをサブスクリプションスケジュールフェーズで使用します。
注文ラインを改訂および終了する
以前の注文ラインを部分的または全面的に終了すると、Salesforce ではマイナス数量の注文ラインが作成されます。Stripe ではマイナスのラインアイテムは使用できません。注文修正によって商品または商品の一部の数量がサブスクリプションから削除された場合、マイナス数量の注文ラインは、改訂された以前の注文ラインと合算されます。
たとえば、初回の注文に 1 つのラインアイテムが含まれていて、その数量が 2 であったとします。注文修正によって数量が 1 つ減らされたとします。この結果として、Stripe の新しいサブスクリプションスケジュールフェーズには、数量が 1 の単一のサブスクリプションアイテムが組み込まれます。
For positive-quantity order lines, the app creates a unique subscription schedule phase item in Stripe.
以前の注文修正に含まれている注文ラインを変更する注文アイテムはすべて、以前のサブスクリプションフェーズに存在している必要があります。言い換えると、注文でラインアイテムをスキップした場合、そのラインアイテムを改訂したときに注文修正でそのラインアイテムをスキップする必要があります。
同じ商品および価格を使用した複数の注文ライン
Stripe では、同一の価格 ID で複数のサブスクリプションスケジュールフェーズアイテムを使用することはできません。Salesforce にはこの制限はありません。
If you use the same price on multiple order lines, the app does the following:
- Stripe で価格を複製する
- 価格をサブスクリプションスケジュールフェーズに追加する
- 価格を使用後にアーカイブする (
active = false
)
Stripe の複製された価格には以下のメタデータが含まれます。
salesforce_
: 価格が別の価格の複製であることを示しますduplicate = true salesforce_
: 使用後の価格を自動的にアーカイブしますauto_ archive = true salesforce_
: 複製された価格に使用される価格の ID が含まれますoriginal_ stripe_ price_ id = price_ xyz
月の途中の修正
The app requires that all order amendments co-terminate with the initial order. If the amendment order starts on a different day of the month than the initial order, you must:
- 修正注文の終了日を設定します。
- 修正注文でサブスクリプションの期間を 1 カ月単位の数に設定します。
月の途中の注文修正の例:
初回の注文 | 注文修正 | |
---|---|---|
開始日 | 2022 年 1 月 1 日 | 2022 年 2 月 15 日 |
終了日 | 2022 年 12 月 31 日 | 2022 年 12 月 31 日 |
サブスクリプション期間 | 12 | 10 |
遡及修正
The app processes backdated amendments in current time. A backdated order amendment starts in the past, which means the latest phase on the subscription schedule won’t align with the start date on the order amendment.
For example, a customer wants to amend an existing subscription, and pushes the amendment order through the app at a later date than its effective date.
同日の修正
The app can process same-day amendments, such as the following scenarios:
- サブスクリプションが今日開始し、顧客が開始日と同日に契約を修正したいと考えている。
- サブスクリプションが将来の日付に開始し、顧客が元の注文と同じ開始日と終了日を使用して注文を修正したいと考えている。
既存のサブスクリプションでの同日の修正
In this case, the app treats the amendment as a prorated order amendment, with some differences:
- 前のフェーズの終了日では、現在の日付の午前 0 時 (この例ではすでに過ぎている) ではなく、特殊な
now
値が使用されます。 - 次のフェーズ (たとえば、注文修正) の開始日でも、
now
値が使用されます。 - 比例配分ラインアイテムの金額は、契約の存続期間の全請求額と等しくなります。
同日の将来の修正
If a subscription hasn’t started, you can’t use the special now
value in the same-day amendment when the subscription starts. In this case, the app does the following:
- 同じ注文期間 (たとえば、開始日と終了日) を共有している、注文 (初回または修正) の単一の項目をすべて収集する
- 該当するアイテムを新しいフェーズに追加する
- 以前の注文に相当するフェーズを削除する
Stripe では、以前の注文に関連付けられているサブスクリプションスケジュールフェーズのメタデータを完全に削除します。
挿入注文修正の例
次は、注文修正の例と Stripe Billing へのマッピング方法です。
最初の注文: 最初の注文は、顧客とサブスクリプションのスケジュールを Stripe の単一のサブスクリプションフェーズに統合します。
注文修正: 2022 年 1 月 15 日に、Salesforce で最初の注文に対する注文修正を作成します。
初回の注文と注文修正の値は以下のとおりです。
初回の注文 | 注文修正 | |
---|---|---|
開始日 | 2022 年 1 月 1 日 | 2022 年 2 月 1 日 |
サブスクリプション期間 | 12 | 11 |
ラインアイテム | 1 商品 A
| 2 つ 商品 A
商品 B
|
Salesforce CPQ の注文修正で、数量 -4 (数量を 4 減らす) の注文ラインとして商品 A を表します。単価が同じであるため、Stripe ではサブスクリプションスケジュールフェーズアイテムで同じ Price
オブジェクトを使用します。
注文修正が有効化されると、サブスクリプションスケジュールが更新され、次のフェーズが組み込まれます。
フェーズ 1 | フェーズ 2 | |
---|---|---|
開始日 | 2022 年 1 月 1 日 | 2022 年 2 月 1 日 |
終了日 | 2022 年 2 月 1 日 | 2023 年 2 月 1 日 |
項目 | 商品 A、数量: 10 |
|
終了注文修正
契約を完全にキャンセルするには、終了注文修正を使用します。この注文修正によって、注文のすべてのラインアイテムの数量が 0 に設定されます。
When this happens, the app updates the end date of the last subscription schedule phase to the start date of the termination order amendment.
注文を開始日と同日に完全終了する場合は、前のフェーズを変更するのではなく、サブスクリプションスケジュールをキャンセルします。
比例配分注文修正
比例配分注文修正の開始日は、請求サイクル範囲外であり、終了日は請求サイクルと等しくなりません。
たとえば、毎年請求される 2 年契約を修正する注文により、開始が 6 カ月目になり、期間が 1.5 年になるとします。この注文は比例配分注文修正です。顧客には、標準請求サイクルに該当しない注文部分に相当する比例配分額が修正の開始日に請求されます。
When you create a prorated order amendment in Salesforce, the app does the following in Stripe for each order line to prorate:
- 新しい Price オブジェクトを作成して、比例配分金額を表します
- 新しく作成された Price の請求書アイテムを新しく作成されたフェーズに追加して、比例配分金額を表します
- サブスクリプションアイテムの数量を更新して、比例配分金額以外は請求せずに、適用されるタイミングで修正を取り込みます
Stripe Billing は、請求サイクルの最後に商品の全額と数量に対する請求書を送信します。上記の例では、請求サイクルは 12 カ月目に終了し、請求書の金額は 120 USD x 2 = 240 USD となります。
以下の価格は比例配分できません。
- Prices configured for usage-based billing—The amount due calculates after the end of the billing cycle.
- 1 回限りの、非継続的な価格: このタイプの価格は即座に請求され、請求サイクルは関連付けられません。
- 消費スケジュールから作成された段階制の価格。
比例配分注文修正の例
ここでは、注文修正の例を紹介し、注文修正が Stripe でどのように表されるのかを示します。
フェーズ 0 | フェーズ 1 (6 カ月目) | フェーズ 1 (12 カ月目) |
---|---|---|
|
| 3 番目のフェーズは作成されない。フェーズ 1 の 12 カ月目に、フェーズ 1 (6 カ月目) に追加されたサブスクリプションアイテムに対する新しい請求書が作成される。 |
Stripe の単一の比例配分アイテムは、注文アイテムの比例配分金額を表します。これは、請求サイクルの残りの比例配分期間の引き落とし額を意味します。
Stripe Billing の比例配分計算では、次の 2 つの比例配分アイテムが作成されます。
- 以前のプランの未使用の期間に相当するクレジット
- 請求期間の残りの比例配分使用期間に対応する引き落とし額
Salesforce CPQ で計算された比例配分データを使用している場合、Stripe でクレジットラインアイテムは表示されません。
CPQ で計算された比例配分を使用する
When billing information exists in CPQ, the app treats it as the source of truth. This allows other financial systems (such as Stripe) and financial reporting tools (such as NetSuite or QuickBooks) to reconcile proration and other financial data. By default, the app uses CPQ Subscription Prorate Precision
equal to Month
to calculate proration. The app also supports CPQ Subscription Prorate Precision
equal to Monthly and Daily
.
In some cases, amounts won’t match between Stripe and Salesforce because only Stripe does some calculations, and they don’t exist in CPQ. For example, data for taxes and usaged-based billing only exist in Stripe.
比例配分価格を計算する
Salesforce では、比例配分ラインアイテムには次の情報が含まれます。
- サブスクリプション期間
- 単価 (Stripe の
unit_
にマッピング)decimal_ amount - 数量
- 請求サイクル (Stripe の
recurring.
およびinterval recurring.
にマッピング)interval_ count - 開始日
Salesforce CPQ の Month の比例配分の精度
CPQ Subscription Prorate Precision
に Month
が設定されている場合に、注文アイテムのうち、比例配分の対象となる部分を決定するには以下のようにします。
- 請求サイクルに含まれないサブスクリプションの月数 (期間) を計算します。ラインアイテムの開始日、サブスクリプション期間、および請求サイクルを使用して、この値を求めます。
- ラインアイテムの月あたりのコストを計算します。
unit_
にマッピングされた値をサブスクリプション期間で割ります。amount_ decimal - 月あたりコスト (ステップ 2 の値) に、請求サイクルに含まれていない月の数 (ステップ 1 の値) を乗じます。
たとえば、請求サイクルに含まれていない 6 カ月がサブスクリプションに含まれているものとします。ラインアイテムの月あたりのコストは 10 USD です。これは、180 USD の単価を 18 カ月のサブスクリプション期間で割ることで求められます。月ごとのコストの 10 USD に 6 カ月を掛けて 60 USD になります。
Salesforce CPQ の Monthly and Daily の比例配分の精度
CPQ Subscription Prorate Precision
に Monthly and Daily
が設定されている場合に、注文アイテムのうち、比例配分の対象となる部分を決定するには以下のようにします。
- 請求サイクルに含まれないサブスクリプションの (期間の終了時の) 部分的な月を計算します。部分的な月とは、請求サイクルに含まれない日数と同じです。
- ラインアイテムの 1 日あたりのコストを計算します。
unit_
にマッピングされている値を月の日数で割ります。CPQ は、1 年の日数を 1 年の月数で割る (365 を 12 で割る) ことで月の日数を計算します。amount_ decimal - 1 日あたりのコスト (ステップ 2 の値) に、請求サイクルに含まれていない日数 (ステップ 1 の値) を乗じます。
The app calculates prorations based on the setting for CPQ Subscription Prorate Precision
.
カスタマイズした価格フィールドを使用して比例配分価格を計算する
Typically, UnitPrice
maps to unit_
in Stripe. You can also use a custom field for the price. The app assumes the custom field you specify is the price of the product for the entire billing cycle.
たとえば、UnitPrice
の 180 USD ではなく、カスタム価格フィールドで 120 USD を指定したとします。四半期ごとの請求サイクルでは、四半期ごとのコストは 30 USD になります。これは、120 USD を 4 つの四半期で割ることで求められます。
For a prorated order line, the app expects the full amount of the billing cycle for the custom price field. The app calculates the prorated amount from this value.
一意の価格を使用して比例配分を表す
このアプローチは、Stripe の Price
オブジェクトを生成して比例配分金額を表す点に特色があります。各比例配分金額では、元の全請求価格と同じ商品に関連付けられた Price
オブジェクトが Stripe で作成されます。すなわち、比例配分ラインアイテムと比例配分されないサブスクリプションラインアイテムに相当する 2 つの Price
オブジェクトが個別に作成されます。
Price
オブジェクトのメタデータ salesforce_
は、オブジェクトがこの目的で作成されたことを示します。
これらの Price は、サブスクリプションで使用された後に自動的にアーカイブされます (active=false
)。
比例配分請求書アイテムの請求方法
比例配分注文修正に相当するフェーズが開始すると、保留中の請求書アイテムが顧客のサブスクリプションに追加されます。
The app listens for newly created invoice items to determine if they represent prorated amounts. If they do, the app creates and finalizes an invoice for the subscription. The invoice bills the customer for the prorated amount of their subscription.
サブスクリプションで請求対象にするアイテムは指定できません。サブスクリプションは、関連付けられている保留中の請求書アイテムをすべて請求します。