サブスクリプションの注文
Salesforce と Stripe 間でサブスクリプションの注文を同期する方法をご紹介します。
The Stripe Billing app for Salesforce CPQ creates a subscription schedule in Stripe for every activated order in Salesforce that has a subscription type. In a Salesforce order, each order line creates a subscription item (for a recurring product) or an invoice item in Stripe. Order lines can’t be split into multiple line items in Stripe.
デフォルトの場合、Stripe の各サブスクリプションスケジュールが自動では更新されません。サブスクリプションを更新するには、以下のいずれかを行います。
- 新しいサブスクリプションの開始日と期間を使用して注文修正を作成します。
- すべてのサブスクリプションを自動更新するようにシステムを設定します。
注
The “native” quote object–distinct from the CPQ Quote
object–in Salesforce isn’t used. The app uses orders generated from the CPQ Quote
object.
同期する注文を決定する
The app checks Salesforce every 90 seconds for updated orders since the last successful order sync.
The app attempts to sync all orders that meet the following conditions:
- 注文ステータスが有効化されている。このデフォルトの条件は削除またはカスタマイズできます。
- 注文タイプが新規である。
- 少なくとも 1 つの注文ラインがサブスクリプション商品である。これは、
SBQQ_
に設定されていることを意味します。SubscriptionType_ c
If all order lines are one-time purchase items, the app creates a one-time invoice instead of a subscription.
注文日
When you set up the app, you can choose a backfill date for orders. Only orders created after this date sync to Stripe.
サブスクリプションの開始日を遡及適用できます。これは、Stripe で使用される注文開始日です。注文を有効化する際にエラーが発生しないようにするために、見積もりおよび関連付けられた注文で開始日を指定する必要があります。
必要に応じてトライアルの終了日を指定できます。トライアルの日付の設定がない場合、顧客にトライアル期間は提供されません。
注文同期条件
デフォルトの同期条件にカスタム条件を追加できます。カスタム条件は、標準 SOQL 構文を使用して記述します。
カスタム条件の追加またはデフォルトの条件の削除を行うには、Stripe Billing Setup > Sync Preferences (同期の設定) > Custom Order Sync Conditions (カスタム注文同期条件) に移動します。
制限
The app can’t sync orders with more than 100 recurring line items. An error appears in Salesforce if an order has more than 100 recurring lines.
Salesforce で数量を整数で指定する必要があります。Stripe では数量に小数を使用できません。注文に小数の数量が含まれている場合、Salesforce でエラーが表示されます。
注文に含まれているラインアイテムはすべて、期間数と期間タイプが同じでなければなりません。デフォルトの場合、期間数は Billing Frequency
フィールドからマッピングされます。期間タイプは日次または月次です。Stripe では 1 件の注文で複数の請求サイクルを使用することはできません。たとえば、2 カ月ごとに請求されるラインアイテムと毎月請求されるラインアイテムを 1 つの注文に混在させることはできません。
ラインアイテムを除外する
デフォルトでは、すべてのラインアイテム (0 のラインアイテムを含む) が Salesforce から Stripe に同期されます。Stripe で作成されたサブスクリプションスケジュールから特定のラインアイテムを除外できます。たとえば、Stripe の継続的な請求書に表示しない、情報提供のみを目的とするラインアイテムを除外できます。
ラインアイテムを除外するには、注文アイテムの Skip Line Item in Stripe
を true
に設定します。
When this field is set to true
, the app skips the order item and excludes it from the line items of the subscription schedule phase in Stripe. The internal field name is Skip_
(not excluding the package prefix).
サブスクリプションスケジュールのマッピング
Salesforce で有効化された注文により、Stripe でサブスクリプションスケジュールが作成されます。各フィールドは以下のようにマッピングされます。
Salesforce の注文のフィールド | Stripe の Subscription Schedule のフィールド | 注 | 必須 |
---|---|---|---|
Quote、Start date (SBQQ_ ) | 開始日 | ||
Quote、Subscription term | フェーズ / 繰り返し | ||
End behavior (終了時の動作) | デフォルト値は cancel です。サブスクリプションを自動更新する場合は、データマッパーでこのマッピングを設定できます。 | ||
Payment term (SBQQ_ ) | Default settings、Invoice_settings、Days until due (期日までの日数) |
ラインアイテムのマッピング
Salesforce で有効化された注文の各ラインアイテムは以下のようにマッピングされます。これらのフィールドは必須です。
If the unit price for an order item is different from the pricebook unit price, the app uses the order item price and creates a new Stripe price.
Salesforce のフィールド (OrderItem オブジェクト) | Stripe の Line Item のフィールド | 注 |
---|---|---|
Pricebook Entry、UnitPrice | 料金 | Stripe Price には、価格表アイテムで指定された単価が含まれます。カスタムフィールドを使用して、顧客に請求する継続価格を表すと、このマッピングを設定できます。 |
OrderItem、UnitPrice | 料金 | Stripe の Price には、注文ラインアイテムで指定された単価が含まれます。カスタムフィールドを使用して、顧客に請求す継続価格を表すと、このマッピングを設定できます。 |
Quantity (OrderItem. ) | 数量 | You must specify the quantity as an integer; otherwise, the quantity is forced to 1 and the price adjusts to represent the net amount of the line item cost. If the billing type is arrears (usage-based billing), the quantity isn’t set on the line item. Instead, you must report the quantity to Stripe before the end of the customer’s billing period. |
サブスクリプションの変更
You can’t update an activated order in Salesforce, and any changes you make to an order in Salesforce won’t sync to Stripe. To adjust or partially cancel a subscription mid-cycle, you can use an order amendment.
By default, subscription schedules won’t automatically renew. To update the renewal information, create an order amendment that’s associated with the original contract.
また、デフォルトで自動更新されるようにこの機能をカスタマイズすることも、Stripe で更新ロジックを直接管理することもできます。