This article covers
The invoice has 3 line items of the same metered addon
Summary
The pending invoice has 3 line items of the different billing periods of the same metered add-on item.
Let say,
Subscription Sub1 has an unbilled charges line item as
plan test1-USD-Monthly of the current term 27 Sep 2022 to 27 Oct 2022
addon metered-addon1-USD-Monthly of billing period 27 Aug 2022 to 27 Sep 2022
addon metered-addon2-USD-Monthly of billing period 27 Aug 2022 to 27 Sep 2022
addon metered-addon3-USD-Monthly of billing period 27 Aug 2022 to 27 Sep 2022
addon non-metered-addon1-USD-Monthly of the current term 27 Sep 2022 to 27 Oct 2022
addon non-metered-addon2-USD-Monthly of the current term 27 Sep 2022 to 27 Oct 2022
addon metered-addon3-USD-Monthly of billing period 27 Aug 2022 to 27 Sep 2022
addon metered-addon3-USD-Monthly of billing period 07 Sep 2022 to 27 Sep 2022
Video: https://www.loom.com/share/47822da983e34aa692ffde83c9f66f23
In this case when there is a pending invoice that is metered billing is enabled for the merchant site then if there are any mid-term addon changes for the subscription then the pending invoice will have all those line items of that addon or item.
For example, in a given period, if the addon is added twice i.e 1st Jan to 10th Jan & 25th Jan to 31st Jan, then you will have two line items for that addon with different billing periods.
From CB DB we can see when the addon was added to the subscription. In the subscription_history_items table you can see the duration when the addon was removed and added back to the subscription.
The pending invoice will show the addon period when it was attached to the subscription.
This is the expected behavior, Since the addon was present on the subscription multiple times, it's tracked like this.
Pending invoice has multiple line items:
Subscription_history_items table data:
Sample jira: https://mychargebee.atlassian.net/browse/INVENGG-13752