Use case
The fictional company used in this guide, called Acme Inc, is a new Metronome client. In this example, today’s date is August 15, 2024. Acme Inc has a contract outside of Metronome with a monthly billing schedule that started on June 1, 2024. Invoices for June and July were already issued outside of Metronome.Create the contract
First, create the contract using the/contracts/create endpoint, entering the original contract details (for example, starting commit/credit balances and start date). Set the usage_statement_schedule.invoice_generation_starting_at field to indicate when Metronome should begin generating invoices. In our example, that date is August 1, 2024, since the customer hasn’t been billed for August yet.
Import the invoices
After creating the contract, import the corresponding invoices with the/contracts/createHistoricalInvoices endpoint. All you’ll need is the quantities for each line item on the invoice. Metronome combines these with the unit prices specified on the contract to calculate the total amount on the invoice and the effects on the customer’s credit and commit balances.
(Optional) Import hourly or daily breakdowns
To use Metronome to retrieve hourly or daily breakdowns of customer usage and costs, specify time-windowed quantities by populating thesubtotals_with_quantity field of the line item in lieu of the quantity field. Specify the breakdown_granularity of the invoice. When generating the invoice for the entire billing period, Metronome sums up the subtotals of each window.
INFOMetronome doesn’t send imported invoices to the Stripe integration. This prevents sending duplicate invoices to customers.