商品と価格を使用した従量課金の設定
商品やサービスの使用量に基づいて顧客に請求します。
従量課金では、商品やサービスの使用量に応じて顧客に請求できます。
このガイドでは、Procuct (製品) と Price (価格) を使用して、メーターを作成する方法、料金体系と請求書を設定する方法、メーターイベントを送信して顧客の使用量を記録する方法について解説します。Alpaca AI という架空の生成 AI 企業をモデルに、従量課金モデルのコア概念について学びます。Alpaca AI は、100 トークンあたり 0.04 USD を顧客に販売し、月末に後払いで請求していると仮定します。
Here’s what the lifecycle looks like for a typical usage-based billing integration that uses products and prices:
メーターを作成する
Meters specify how to aggregate meter events over a billing period. Meter events represent all actions that customers take in your system (for example, API requests). Meters attach to prices and form the basis of what’s billed.
For the Alpaca AI example, meter events are the number of tokens a customer uses in a query. The meter is the sum of tokens over a month.
You can use the Stripe Dashboard or API to configure a meter. To use the API with the Stripe CLI to create a meter, get started with the Stripe CLI.
サブスクリプションを作成
サブスクリプションを使用すると、顧客を特定の価格に関連付けて、継続的な金額を請求することができます。
Stripe ダッシュボードまたは API を使用して、顧客、商品、従量課金ベースの価格を含むサブスクリプションを作成します。
Alpaca AI の例では、Alpaca AI 商品のサブスクリプションを、ユニットあたり 0.04 USD の従量制料金で、月ごとに John Doe に請求を行う商品を作成します。
注
1 つの従量制料金を複数のサブスクリプションに関連付けることができます。
請求書プレビューを作成する
請求書プレビューを作成することで、メーターの価格や使用量などの詳細が記載された顧客の請求書をプレビュー表示できます。