コンテンツにスキップ
アカウントを作成
または
サインイン
Stripe ドキュメントのロゴ
/
AI に質問する
アカウントを作成
サインイン
始める
支払い
売上
プラットフォームおよびマーケットプレイス
資金管理
開発者向けリソース
概要
Billing
概要Billing API について
サブスクリプション
Invoicing
従量課金
    概要
    従量課金の仕組み
    ユースケース
      従量課金
      定額手数料と超過料金
      Credit-based pricing model
    請求する使用量を記録
    請求クレジットを提供する
    使用量を監視する
    従量課金設定を管理
    高度な従量課金型請求
見積もり
顧客管理
Billing と他のプロダクトの連携
売上回収
オートメーション
実装内容をテストする
税金
概要
Stripe tax を使用
法規制の遵守・対応管理
レポート機能
概要
レポートの選択
レポートを設定
Reports API
複数のアカウントのレポート
収益認識
データ
概要スキーマ
カスタムレポート
Data Pipeline
データ管理
ホーム売上Usage-based billingUse cases

注

このページはまだ日本語ではご利用いただけません。より多くの言語で文書が閲覧できるように現在取り組んでいます。準備が整い次第、翻訳版を提供いたしますので、もう少しお待ちください。

Set up a flat fee and overages pricing model

Charge customers a flat rate with the option to pay for additional usage in arrears.

Flat fee with overages combines predictable billing with the flexibility to scale. Customers pay a set recurring fee for a base package, and any usage beyond that limit is billed separately. This model works well if you want steady, reliable revenue while still giving customers room to grow. The base fee covers core value, while overages ensure that heavy users pay in proportion to what they consume. For example, if you run a video hosting platform, you might include 1,000 monthly video streams in a 200 USD flat fee. If a customer streams more than that, each additional stream is billed as an overage. At the end of the month, Stripe sends an invoice that combines the flat fee with any usage above the included limit, automatically charging the customer’s payment method on file or prompting them to add one.

What you’ll build

In this guide, build a flat fee and overages pricing model for a fictional company called Alpaca.ai, which provides LLM. They charge customers at the following rates:

License Fee
Per user100 USD
Usage Fee
0-10000 USD
1000+0.04 USD

To implement this model, you create meters to record the usage, products and prices to represent your service, a customer, and a customer subscription.

Create a meter

メーターは、請求期間中のメーターイベントを集計する方法を指定するものです。メーターイベントは、顧客がシステムで実行するすべてのアクション (API リクエストなど) を表します。メーターは料金に関連付けられており、請求内容の基礎になります。

Alpaca AI の例では、メーターイベントは顧客がクエリで使用するトークンの数です。メーターは 1 カ月あたりのトークンの合計です。

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.

  1. メーターページで、メーターを作成をクリックします。
  2. メーターを作成ページで、以下を実行します。
    • メーター名には、表示用および社内用のメーターの名前を入力します。Alpaca AI の例では、「Alpaca AI tokens」と入力します。
    • イベント名に、使用量を Stripe に報告するときにメーターイベントに表示する名前を入力します。Alpaca AI の例では、「alpaca_ai_tokens」と入力します。
    • Set the Aggregation method in the dropdown:
      • Alpaca AI の例では、合計を選択します。これにより、報告された「値の合計」 (この例では顧客が使用するトークンの数)が出され、請求する使用量が決定されます。
      • 報告されたイベントの「数」に基づいて請求する 件数 を選択します。
      • 最後 を選択すると、報告された「last value」に基づいて請求できます。
      • プレビューペインを使用して、使用状況イベントの例を設定し、集計方法を確認します。
    • メーターを作成をクリックします。
    • (オプション) 詳細設定で、使用状況データにタグ付けするディメンションを指定します。セグメント固有のアラートをきめ細かく生成したり、属性の組み合わせに基づいて使用状況を細かく価格設定したりするには、分析とレポート作成用に入力されたディメンションを使用して使用状況データを送信します。ディメンションの例としては、LLM モデル、トークンタイプ、地域、イベントタイプなどがあります。

Create a pricing model

Use the Stripe Dashboard or API to create a pricing model that includes your Products and their pricing options. Prices define the unit cost, currency, and billing period.

For the Alpaca AI example, you create a product with a metered price of 0.04 USD per hundred units, billed at a monthly interval. Use the meter that you created in the previous step.

  1. On the Product catalog page, click Create product.
  2. On the Add a product page, do the following:
    • For Name, enter the name of your product. For the Alpaca AI example, enter Alpaca AI usage.
    • (Optional) For Description, add a description that appears in Checkout, in the customer portal and in quotes.
    • Select Recurring.
    • Under Billing period, select More pricing options.
  3. On the Add price page, do the following:
    • Under Choose your pricing model, select Usage-based.
    • Choose your pricing structure:
      • For the Alpaca AI example, select Per Tier and Graduated.
      • In the first row of the grid, set First unit to 0, Last unit to 1,000, Per unit to 0 USD, and Flat fee to 0 USD.
      • In the second row of the grid, set First unit to 1,001, Last unit to ∞, Per unit to 0.04 USD, and Flat fee to 0 USD.
      • Below, you will create another price to charge customers the 100 USD fee at the beginning of the month. A customer’s second invoice contains their usage fees from the previous month and their license fee for the upcoming month.
      • (Optional) If you want to bill customers the initial license fee at the end of the month, update the first row of the grid to set the Flat fee to 100 USD.
    • Under Meter, select the meter you created previously. For the Alpaca AI example, select Alpaca AI tokens from the dropdown.
    • Select the Billing period. For the Alpaca AI example, select Monthly.
    • Click Next.

Next, create the 100 USD monthly fee.

  1. On the Product catalog page, click Create product.
  2. On the Add a product page, do the following:
    • For Name, enter the name of your product. For the Alpaca AI example, enter Alpaca AI license fee.
    • (Optional) For Description, add a description that appears in Checkout, in the customer portal and in quotes.
    • Select Recurring.
    • Under Billing period, select More pricing options.
  3. On the Add price page, do the following:
    • Select *Recurring.
    • For Amount, enter 100 USD.
    • For Currency, select USD.
    • For Billing Period, select Monthly.
    • Click Add Product.

Create a customer

Next, create a customer.

  1. On the Customers page, click Add customer.
  2. On the Create customer page, do the following:
    • For Name, enter the name of your customer. For the Alpaca AI example, enter John Doe.
    • (Optional) Add an email address and description for your customer.
    • Click Add customer.

Create a subscription

Subscriptions allow you to charge recurring amounts by associating a customer with a specific price.

Use the Stripe Dashboard or API to create a subscription that includes your customer, product, and usage-based price.

For the Alpaca AI example, you create a subscription for the Alpaca AI usage product and Alpaca AI license fee product.

注

You can associate a single metered price with one or more subscriptions.

When you create a billing_mode=flexible subscription, Stripe excludes metered line items from the first invoice since no prior usage exists to bill. Stripe creates an invoice only if the subscription is backdated with previously accrued usage or if pending invoice items exist. When you create a billing_mode=classic subscription, Stripe generates a zero monetary value invoice line item for each metered subscription item.

  1. On the Subscriptions page, click Create test subscription.
  2. On the Create a test subscription page, do the following:
    • Under Customer, select the name of your customer. For the Alpaca AI example, select John Doe.
    • Under Product, select your price. For the Alpaca AI example, select the price under Alpaca AI usage and Alpaca AI license fee.
    • (Optional) Modify the subscription details and settings as needed.
    • Click Create test subscription.

Send a test meter event

Use Meter Events to record customer usage for your meter. At the end of the billing period, Stripe bills the reported usage.

You can test your usage-based billing by sending a meter event through the Stripe Dashboard or API. When using the API, specify the customer ID and value for the payload.

After you send meter events, you can view usage details for your meter on the Meters page in the Dashboard.

  1. On the Meters page, select the meter name. For the Alpaca AI example, select Alpaca AI tokens.
  2. On the meter page, click Add usage > Manually input usage.
  3. On the Add usage page, do the following:
    • Select your customer from the Customer dropdown.
    • For Value, enter a sample value. For the Alpaca AI example, enter 3000.
    • Click Submit.

Create a preview invoice

Create a preview invoice to see a preview of a customer’s invoice that includes details such as the meter price and usage quantity.

  1. On the Subscriptions page, select a subscription. For the Alpaca AI example, select the subscription for Jenny Rosen.

  2. On the subscription details page, scroll down to the Upcoming invoice section. The preview invoice shows the subscription amount to bill the customer on the specified date.

  3. Click View full invoice to see complete details for the upcoming invoice, including:

    • Customer
    • Billing method
    • Creation date
    • Connected subscription
    • Subscription details (usage quantity and meter price)
    • Amount due

    Because Stripe processes meter events asynchronously, upcoming invoices might not immediately reflect recently received meter events.

オプションRetrieve usage for a custom time period

Use the Meter Event Summary to retrieve total usage for a custom time period. The meter event summary returns a customer’s aggregated usage for a period, based on the aggregation formula defined by the meter.

In the Alpaca AI example, the meter event summary returns the sum of tokens for a specific customer, meter, and time window.

Because Stripe processes meter events asynchronously, meter event summaries might not immediately reflect recently received meter events.

Command Line
cURL
Stripe CLI
Ruby
Python
PHP
Java
Node.js
Go
.NET
No results
curl -G https://api.stripe.com/v1/billing/meters/{{METER_ID}}/event_summaries \ -u "
sk_test_BQokikJOvBiI2HlWgH4olfQ2
:"
\ -d customer={{CUSTOMER_ID}} \ -d start_time=1717249380 \ -d end_time=1717249440
このページはお役に立ちましたか。
はいいいえ
  • お困りのことがございましたら 、サポートにお問い合わせください。
  • 早期アクセスプログラムにご参加ください。
  • 変更ログをご覧ください。
  • ご不明な点がございましたら、お問い合わせください。
  • LLM ですか?llms.txt を読んでください。
  • Powered by Markdoc