# Upcoming invoices estimate

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


Estimate of the upcoming scheduled invoices (subscription activations, renewals etc) of a customer. For now preview of the invoices generated on the immediate upcoming date is supported. Say a customer has couple of subscription renewals scheduled on _Jan,10th_ and another subscription renewal scheduled on _Jan,15th_. This API gives the preview of all the invoices scheduled to be generated on _Jan,10th_ (immediate upcoming date).

In the response:

-   **estimate.invoice\_estimates\[\]** has details of the invoices scheduled to be generated.

**Note:** If _consolidated invoicing_ is enabled you may use this API to test whether upcoming renewals are consolidated.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/customers/__test__8asyKSOcec7pP6/upcoming_invoices_estimate \
     -u {site_api_key}:
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Estimate.UpcomingInvoicesEstimate("__test__8asyKSOcec7pP6").Request();

Estimate estimate = result.Estimate;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    estimateAction "github.com/chargebee/chargebee-go/v3/actions/estimate"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := estimateAction.UpcomingInvoicesEstimate("__test__8asyKSOcec7pP6", nil).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        Estimate := res.Estimate
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.EstimateUpcomingInvoicesEstimateRequest{}
  res, err := client.Estimate.UpcomingInvoicesEstimate("__test__8asyKSOcec7pP6", req)
      if err != nil {
        fmt.Println(err)
    } else {
        Estimate := res.Estimate
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = Estimate.upcomingInvoicesEstimate("__test__8asyKSOcec7pP6").request();

        Estimate estimate = result.estimate();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.estimate.Estimate;
import com.chargebee.v4.models.estimate.params.UpcomingInvoicesEstimateParams;
import com.chargebee.v4.models.estimate.responses.UpcomingInvoicesEstimateResponse;

public class UpcomingInvoicesEstimate {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        UpcomingInvoicesEstimateResponse response = client.estimates().upcomingInvoicesEstimate("__test__8asyKSOcec7pP6");

        Estimate estimate = response.getEstimate();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.estimate.upcomingInvoicesEstimate("__test__8asyKSOcec7pP6");

    console.log(result);
    const estimate = result.estimate;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->estimate()->upcomingInvoicesEstimate("__test__8asyKSOcec7pP6");
$estimate = $result->estimate;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Estimate.upcoming_invoices_estimate("__test__8asyKSOcec7pP6")
estimate = response.estimate
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::Estimate.upcoming_invoices_estimate("__test__8asyKSOcec7pP6")

estimate = result.estimate
```

## Sample Response

```json
{
  "estimate": {
    "created_at": 1517492965,
    "invoice_estimates": [
      {
        "amount_due": 2000,
        "amount_paid": 0,
        "credits_applied": 0,
        "currency_code": "USD",
        "customer_id": "__test__8asyKSOcec7pP6",
        "date": 1517492965,
        "line_item_discounts": {},
        "line_item_taxes": {},
        "line_items": [
          {
            "amount": 1000,
            "customer_id": "__test__8asyKSOcec7pP6",
            "date_from": 1517492965,
            "date_to": 1519912165,
            "description": "basic USD",
            "discount_amount": 0,
            "entity_id": "basic-USD",
            "entity_type": "plan_item_price",
            "id": "li___test__8asyKSOcecDPPF",
            "is_taxed": false,
            "item_level_discount_amount": 0,
            "object": "line_item",
            "pricing_model": "per_unit",
            "quantity": 1,
            "subscription_id": "__test__8asyKSOcecBvPD",
            "tax_amount": 0,
            "unit_amount": 1000
          },
          {..}
        ],
        "object": "invoice_estimate",
        "price_type": "tax_exclusive",
        "recurring": true,
        "round_off_amount": 0,
        "sub_total": 2000,
        "taxes": {},
        "total": 2000
      },
      {..}
    ],
    "object": "estimate"
  }
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/customers/{customer-id}/upcoming_invoices_estimate

## Input Parameters

- `include_usage_charges` (optional, boolean, default=false)
  When set to `true`, the `invoice_estimates[]` returned in the response includes usage-based line items, if any. These are `invoice_estimates[].line_items[]` where [`line_items[].metered`](/docs/api/estimates/estimate-object#invoice_estimate_line_items_metered) is `true`.
  
  **See also:**
  
  [Pricing for usage-based line items](https://www.chargebee.com/docs/billing/2.0/usage-based-billing/link-pricing).

## Returns

- `estimate` (Estimate object)
  Resource object representing estimate
