Group invoice line items
To help your customers better understand your invoices (including PDFs, Hosted Invoice Page, and invoice emails), you can categorize and display invoice line items under different groups. You can also hide groups of line items. This is helpful if some line items are excessively detailed: you can configure it so that only their group-level subtotal is visible to your customers.
This guide describes how to organize one-time and subscription invoices by creating dynamic filters and groups in the Stripe Dashboard.
Dynamically group invoice line items with CEL expressions.
Before you begin
To use this feature, you define rules and templates with Common Expression Language (CEL) expressions. To learn more about CEL, read the introduction. This guide provides some examples in the invoice template context, but we recommend reading the official language definition on GitHub. You can also start with a common use case.
Only available with Billing Scale
Invoice line item grouping with CEL requires Billing Scale pricing.
Limitations
This feature has some limitations:
- You can only apply CEL expressions to invoices created from the Dashboard.
- Each CEL expression has a maximum length of 1024 characters.
- A template has a maximum of 10 line item grouping policies.
- Each CEL expression has a expansion depth limit of 1. For example, we support
line_item.invoice_item.expand().description
but notline_item.subscription.expand().default_payment_method.expand().type
. - CEL expressions don’t support every field on the invoice line item object in the public API.
- CEL expressions use the API Version
2022-11-15
as its underlying resource. Later API versions and preview features are not supported automatically for the duration of the beta.
Group invoice line items
You can group invoice line items in the Dashboard. If you want to use the API, you can request early access to the beta in the API tab.
Use cases
The following table provides some common examples of grouping policies.
Use case | Details and example |
---|---|
Group by invoice line item metadata | You might have a sales-led process that ties different purchase order numbers to each of your invoice line items with a metadata named “PO”. In this example, the Group by field creates groups for each purchase order number and lists line items corresponding to that PO number from their metadata field. Group by:
Filter by:
|
Group by price metadata | You might want to group invoice line items by the price metadata to organize the invoice by the type of price they have purchased. The invoice is sectioned off according to the Group by:
Filter by:
|
Group by prorations | You might have many proration line items in your subscription invoice and want to simplify your invoice for customers. This example groups line items that have a prorated amount larger than 0 USD in a group called “Credits” and negative line items in a group called “Debits”. Group by:
Filter by:
|
Group line items by their description | All ungrouped line items are grouped under the Other section of a summary by default. If you want to list otherwise ungrouped line items by their description, you can expand the Other section under a summary. To prevent overriding any other grouping policy, make sure this is the last item in the policy list. Group by:
|