---
title: Modifying & Recalculating Invoices
slug: docs/recalculating-invoices
createdAt: 2024-07-18T13:49:11.435Z
---

Amberflo allows you to modify and recalculate invoices that are still open in the **current billing period** or within the **grace period**. You can apply changes such as new pricing plans or discounts, and the system will generate a new invoice based on the customer’s existing usage and any updated terms.

The updated invoice replaces the existing one, ensuring accuracy in billing before payment is finalized.

## Changing Pricing Plans

From the **customer details** page, use the **Add New Plan** button in the Pricing Plan section to assign a new pricing plan. This takes you to a configuration page where you can set the new plan terms.

When assigning a new plan, pay attention to the **Start Date** options:

- Selecting **Start of current billing period** will apply the new pricing plan from the beginning of the current period, and the invoice will be recalculated accordingly.
- If the invoice is still in the **grace period**, you will also see the option to apply the plan from the **start of the previous billing period**.

![](https://files.readme.io/a47ad81-Final_sidebar_245.png)

### Change Pricing Plans through the API

This feature is also available at the API level. See: Assign a Pricing Plan to a Customer&#x20;

To recalculate the invoice, pass the `startTimeInSeconds` parameter set to the beginning of the billing period when assigning the plan.

## Apply Discounts

On the **customer details** page, use the **Add** button in the Discounts section to assign a new discount.

Just like with pricing plans, the **Start Date** options control how the discount is applied:

- Selecting **Start of current billing period** will apply the discount from the beginning of the period, and the invoice will be updated.
- If the invoice is in the **grace period**, you can select **Start of previous billing period** to retroactively apply the discount and trigger recalculation.

![](https://api.archbee.com/api/optimize/GQ6FhONXoR2DQjp03hOcB/xzVCtKhGgXUY0rlVkwQk1_screenshot-2024-11-01-at-33132-pm.png)

### Add Discounts through the API

This feature is also available at the API level. See: [Assigning Discounts to Customers](https://enterprise-reference.amberflo.io/docs/assigning-promotions-to-customers)&#x20;

The `startTimeInSeconds` parameter can be passed in at the start of the current billing period to add a discount to the current invoice.
