Metered billing allows you to bill customers for charges incurred during a billing cycle. These charges could be from usage, one-off purchases, prorations, or some other amount not accounted for by the customer's subscription.
Conceptually metered billing on Invoiced is simple. It's just line items! Metered billing should feel natural if you are already familiar with our invoicing API.
Whenever a customer incurs a charge with your business that you want to bill for later then you create a pending line item. A pending line item behaves just like invoice line items, with the distinction that it has not been billed yet. The line item is attached to a customer but not an invoice.
Pending line items get billed to the customer by issuing an invoice. When a pending line item is billed then it will be moved from the customer's account to an invoice. There are two ways that pending line items can be invoiced:
We are going to walk you through a basic metered billing workflow using the Invoiced API.
In order to bill our customer, we must first create an account for them on Invoiced. For this example we are going to invoice our customer with NET 7 payment terms each billing cycle. You could just as easily use AutoPay, which will charge your customer's payment source automatically when invoices are issued on the account.
In this example we are going to bill for charges that happen during our customer's billing cycle, in addition to the base subscription price. The plan we are using was created through the dashboard in Settings → Plans with the ID starter.
Let's pretend during the billing cycle our customer used engineering hours that we want to bill for. Instead of issuing a separate invoice we can just add it to their next subscription invoice.
We are going to use an item that was set up in Settings → Items with the ID engineer_hours. The item already has the price set, however, you can also bill for one-off line items, just like with invoices. The Line Item Object shows all of the attributes that we support for creating line items.
And that's it! You can add further pending line items to the customer, or even edit an existing pending line item. Next time the subscription renews, your pending line items will be added to the invoice.
If your customer is not on a subscription, or you want to bill them now for pending line items, then you can manually trigger an invoice for metered charges.
A new invoice using your customer's pending line items will be generated on the spot. If the customer does not have any pending line items then an error will be returned.
We have gone through a basic metered billing workflow. Of course, business is not always that simple. The Metered Billing section of the API reference details all of the metered billing endpoints available to you.