Metronomの利用量に応じた課金(使用量ベースの課金)の統合に関する意思決定を支援します。次のような領域をカバーしています: **イベント取り込み** 単一またはバッチでのデータ送信、重複排除(同じ情報を二重に計算しないようにすること)、課金対象となる指標の設定 **契約設計** 料金表の設定、料金の調整、複数の条件に基づいた価格設定、商品の構成 **請求書発行のプロセス** 猶予期間の設定、請求書の確定処理、Stripe との同期 **クレジットとコミットメントの管理** 前払い・後払い、利用上限の設定、自動チャージ機能 **Stripe 連携** 遅延請求、税務対応、請求明細項目の制限 次のような場合に使用: Metronome の統合機能を構築・変更・確認する際全般。利用イベントの取り込み、契約や料金表の作成、クレジット・コミットメントの管理、請求設定の構成、Stripe Billing への請求書同期など、すべての関連作業で活用できます。
Guides Metronome usage-based billing integration decisions — event ingestion (single and batch, idempotency, billable metrics), contract design (rate cards, overrides, dimensional pricing, products), invoicing lifecycle (grace periods, finalization, Stripe sync), credit and commit management (prepaid, postpaid, thresholds, auto-recharge), and Stripe integration (arrears invoicing, tax providers, line item limits). Use when building, modifying, or reviewing any Metronome integration — including ingesting usage events, creating contracts or rate cards, managing credits and commits, configuring invoicing, or syncing invoices with Stripe Billing.
Metronome API のベースURL: https://api.metronome.com。認証には Authorization ヘッダーにベアラートークンを使用します。新しい連携では、従来の「プラン」ではなく必ず「契約」を使用してください。
| 構築する内容 | 推奨API | 詳細情報 |
|---|---|---|
| 使用イベントの取り込み | POST /v1/ingest(バッチ処理) |
使用イベントを送信、API クイックスタート、Ingest API リファレンス、取り込みエイリアスを設定 |
| 計測対象の定義 | Billable Metrics API | 課金メトリクスを作成 |
| エンタープライズ向け料金契約 | Contracts + Rate Cards | 顧客契約をプロビジョニング、料金表を作成・管理、契約を作成 および 料金を追加 の API リファレンス |
| 契約期間中の変更 | Contract Edits | 契約を編集、契約編集と上書き、契約ライフサイクルを管理 |
| 請求書のライフサイクルと確定 | Invoices API | Metronome の請求書仕組み |
| 前払い・後払いのコミットメント(契約金)と単発の追加チャージ | Commits + Credits | クレジットと契約金を契約に適用 および 支払いゲート付きコミットメント |
| 請求書を Stripe に同期 | Stripe billing provider config | Stripe で請求 |
| 前払い残高・自動チャージ・支出アラート・しきい値 | Notifications API | 前払い残高のしきい値を設定、支出しきい値を適用、しきい値通知 |
連携について質問を受けたりコードを書いたりする前に、リンク先ページを必ず読んでください。リンク先には Markdown 形式のドキュメントがあります。どの行にも当てはまらない場合は、ドキュメント索引を使って適切なページを探し、ページ URL の末尾に .md を付けて Markdown 形式でダウンロードしてください。
Metronome のエンドポイント、フィールド、金額を指定する前に、必ずリンク先のドキュメントページを読んでください。 エンドポイントのパス、リクエストの形式、単位は誤りやすいため、上記のルーティングテーブルで各タスクのページを確認します。
新しい顧客には常に「契約」を使用し、従来の「プラン」は使わないでください。 プランは廃止予定であり、料金表の上書き、契約金、柔軟なスケジュール機能が利用できません。既存のプラン連携は動作し続けるため、移行の提案をしないでください。ただし移行する場合は、POST /v1/credits/migrateToContracts でクレジット残高を移行します。
契約期間中の変更(新製品、契約金、上書き)には、常に「編集」(POST /v2/contracts/edit)を使用し、廃止予定の「修正」(/v1/contracts/amend)は使わないでください。 編集は積極的に開発されているパスであり、v2 の購読機能に必要です。更新の場合は transition: {type: "renewal", from_contract_id} で新しい契約を作成してください。
本番環境では常にバッチ取り込み(POST /v1/ingest で、リクエストボディとして 1 ~ 100 のイベントオブジェクトを JSON 配列で直接送信し、オブジェクトにラップしない)を使用してください。単一イベントの取り込みはテストのみに使用できます。200 はイベントが受け入れられたことを示しますが、これは評価(レート計算)完了を意味しません。event_type が課金メトリクスと一致しないイベントは保存されますが、使用状況から除外されるため、イベントを送信する前に課金メトリクスを作成してください。
すべてのイベントに一意の transaction_id を必ず付与してください。 この ID はイベント記録時に固定され、再試行時も変更されないまま送信します。UUID でも、ソースレコードから派生した値でも構いません。これは再試行時の二重計算を防ぐ冪等性キーです。試行のたびに ID を再生成すると機能しません。
請求期間のグレースピリオド(デフォルトは billing_period_end_date から 24 時間)が終了する前に、その期間の使用状況を必ず納品してください。 請求書が確定後に遅延したイベントは無視され、訂正は請求書を取り消して再生成する方法のみです。パイプラインの最悪のケースでの遅延がグレースピリオドを超えた場合は、Metronome サポートに連絡してグレースピリオドの延長をリクエストしてください。API では設定できません。
顧客が複数の契約を同時に持つ場合、各契約に usage_filter(group_key と group_values)を設定して、すべての契約ではなく 1 つの契約に使用状況を計算してください。 グループキーはストリーミング課金メトリクス上のグループキー(SQL メトリクスではイベントプロパティ)である必要があります。
契約レベルの契約金またはクレジットアクセスセグメントを契約の ending_before より後にスケジュールしないでください。 契約終了後の使用状況はその契約では評価されないため、その後の日付でリリースされた残高は使用できなくなります。最後のセグメントを契約期間の終了に合わせ、rollover_fraction で残りの残高を更新契約に繰り越してください。
spend_threshold_configuration コミットに applicable_product_ids、applicable_product_tags、specifiers を付与しないでください。 支出しきい値コミットはすべての使用状況に適用され、product_id、name、description、priority のみ受け入れます。prepaid_balance_threshold_configuration コミットだけが製品フィルタを受け入れます。
同一の Stripe 顧客について複数の Metronome 請求書を同時に処理しないでください。 同時処理は保留中の行項目でレース状態(競合)を引き起こします。
料金を契約に直接ハードコードしないでください。 料金表で料金を定義し、カスタム料金には契約レベルの上書きを使用してください。これにより、上書きされていない料金は料金表の変更時に最新のまま保たれます。
USD 金額は常にセント単位で送信してください。 Metronome のデフォルト USD クレジットタイプはセント単位(1000 = 10.00 USD)で、しきい値、契約金、クレジット、料金または上書き価格に適用されます。その他の通貨は整数単位を使用します。
Stripe 請求書の税計算が完了する前にファイナライズしないでください。 Stripe Tax、Avalara、Anrok を使用する場合、税務プロバイダーはファイナライズ前に請求書を処理する必要があります。
Stripe 請求書あたり 250 行項目を超えないでください。 この制限を超えると、すべての行項目が 1 つのエントリに畳み込まれ、製品別の詳細が失われます。製品の粒度を計画し、複合製品を使って高カーディナリティ(多くのバリエーション)メトリクスを集約してください。
支払いを Metronome 請求書の total ではなく、常に Stripe 請求書の合計と照合してください。 Metronome は税抜き行項目を送信し、Stripe はファイナライズ時に税金を追加するため、Metronome の合計は税抜きであり、端数処理で異なる場合があります。
NetSuite を契約の billing_provider_configuration と revenue_system_configuration の両方に設定しないでください。 NetSuite が請求書を発行および回収する場合は請求設定を使用し、Stripe などの別のプロバイダが請求を行い NetSuite が収益認識のために請求書が必要な場合のみ、収益システム設定を使用してください。
ユーザーのリクエストが上記のどの領域にも明確に当てはまらない場合は、以下を参照してください:
Metronome ドキュメント: Metronome に関するあらゆる質問はまずここから始めてください。
API リファレンス: エンドポイントの完全なリファレンス。
LLM 向けドキュメント索引: 機械が読みやすいドキュメント索引。
Stripe 連携ガイド: Metronome 請求書を Stripe と同期します。
Metronome と Stripe の連携方法: 連携パターンと Stripe に留まる内容についての Stripe ガイド。
Metronome API base: https://api.metronome.com. Authenticate with a Bearer token in the Authorization header. Always use Contracts (not legacy Plans) for new integrations.
| Building… | Recommended API | Details |
|---|---|---|
| Ingesting usage events | POST /v1/ingest (batch) |
Send usage events, the API quickstart, the Ingest API reference, and Set ingest aliases |
| Defining what to measure | Billable Metrics API | Create billable metrics |
| Enterprise pricing agreements | Contracts + Rate Cards | Provision a customer contract, Create and manage rate cards, and the Create a contract and Add rates API references |
| Mid-term contract changes | Contract Edits | Edit a contract, Contract edits and overrides, and Manage contract lifecycle |
| Invoice lifecycle and finalization | Invoices API | How Metronome invoices work |
| Prepaid or postpaid commitments and one-off top-ups | Commits + Credits | Apply credits and commits to contracts and Payment-gated commits |
| Syncing invoices to Stripe | Stripe billing provider config | Invoice with Stripe |
| Prepaid balances, auto-recharge, spend alerts, and thresholds | Notifications API | Set prepaid balance thresholds, Enforce spend thresholds, and Threshold notifications |
Read the linked page before answering any integration question or writing code; the links return plain Markdown. If no row fits, use the documentation index to find the right page, and append .md to the page URL to fetch it as Markdown.
POST /v1/credits/migrateToContracts.POST /v2/contracts/edit), not deprecated Amendments (/v1/contracts/amend), for mid-term changes to a contract (new products, commits, overrides). Edits are the actively invested path and required for v2 subscription features. Create a new contract with transition: {type: "renewal", from_contract_id} only for renewals.POST /v1/ingest with a bare JSON array of 1 to 100 event objects as the request body, not wrapped in an object) for production workloads. Single-event ingestion is acceptable only for testing. A 200 means the events were accepted, not rated: events whose event_type matches no billable metric are stored but excluded from usage, so create billable metrics before sending.transaction_id on every event, fixed when the event is recorded and re-sent unchanged on every retry: a UUID stored with the event, or a value derived from the source record. This is the idempotency key that prevents double-counting on retries; an ID regenerated per attempt defeats it.billing_period_end_date by default). A finalized invoice ignores late events and can only be corrected by voiding and regenerating it; if your pipeline’s worst-case lag exceeds the grace period, ask Metronome support to lengthen it (it isn’t configurable through the API).usage_filter (group_key and group_values) on each contract when a customer has more than one concurrent contract, so usage is rated on one contract instead of all of them. The group key must be a group key on the streaming billable metric (an event property for SQL metrics).ending_before. Usage after the contract ends isn’t rated on it, so balance released after that date is stranded; end the last segment at the contract term and use rollover_fraction to carry a remaining balance into a renewal.applicable_product_ids, applicable_product_tags, or specifiers on a spend_threshold_configuration commit. Spend-threshold commits apply to all usage and take only product_id, name, description, and priority; only prepaid_balance_threshold_configuration commits accept product filters.1000 is 10.00 USD) for thresholds, commits, credits, and rate or override prices; other currencies use whole units.total. Metronome sends untaxed line items and Stripe adds tax at finalization, so the Metronome total is pre-tax and can differ by sub-cent rounding.billing_provider_configuration and its revenue_system_configuration. Use the billing configuration when NetSuite issues and collects the invoice; use the revenue system configuration only when another provider such as Stripe bills and NetSuite needs the invoice for revenue recognition.When the user’s request doesn’t clearly fit a single domain above, consult:
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。