# Estimate for creating a customer and subscription

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


Generates an estimate for creating a subscription when the customer does not exist in Chargebee. This estimate API can be called when the customer has not yet signed up and you want to preview how a new subscription would look like for them.

**Note:** Estimate operations do not make any changes in Chargebee; hence this API does not create an actual `customer` or `subscription` record.

The response contains one or more of the following objects:

-   `subscription_estimate`: The subscription details like the status of the subscription (such as `in_trial` or `active`), next billing date, and so on.
-   `invoice_estimate`:The details of the immediate invoice, if there is one. If the subscription is created in `trial`/`future` states, `invoice_estimate` is unavailable as no immediate invoice is generated.
-   `next_invoice_estimate`:This is returned when an immediate invoice is not generated. It contains the details of the invoice that will be generated on the next billing date of the subscription.
-   `unbilled_charge_estimates`: This contains the details of charges that have not been invoiced. This is returned only if the `invoice_immediately` parameter is set to `false`.

## Sample Request

### Default

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/estimates/create_subscription_for_items \
     -u {site_api_key}:\
     -d "billing_address[line1]"="PO Box 9999" \
     -d "billing_address[city]"="Walnut" \
     -d "billing_address[zip]"="91789" \
     -d "billing_address[country]"="US" \
     -d "subscription_items[item_price_id][0]"="basic-USD" \
     -d "subscription_items[billing_cycles][0]"=2 \
     -d "subscription_items[quantity][0]"=1 \
     -d "subscription_items[item_price_id][1]"="day-pass-USD" \
     -d "subscription_items[unit_price][1]"=100 \
     -d "customer[taxability]"="TAXABLE"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Estimate.CreateSubItemEstimate()
		.BillingAddressLine1("PO Box 9999")
		.BillingAddressCity("Walnut")
		.BillingAddressZip("91789")
		.BillingAddressCountry("US")
		.SubscriptionItemItemPriceId(0, "basic-USD")
		.SubscriptionItemBillingCycles(0, 2)
		.SubscriptionItemQuantity(0, 1)
		.SubscriptionItemItemPriceId(1, "day-pass-USD")
		.SubscriptionItemUnitPrice(1, 100)
		.CustomerTaxability(TaxabilityEnum.Taxable)
		.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"
    "github.com/chargebee/chargebee-go/v3/models/estimate"
    enum "github.com/chargebee/chargebee-go/v3/enum"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := estimateAction.CreateSubItemEstimate(&estimate.CreateSubItemEstimateRequestParams{
        SubscriptionItems : []*estimate.CreateSubItemEstimateSubscriptionItemParams{
            {
                ItemPriceId : "basic-USD",
                BillingCycles : chargebee.Int32(2),
                Quantity : chargebee.Int32(1),
            },
            {
                ItemPriceId : "day-pass-USD",
                UnitPrice : chargebee.Int64(100),
            },
        },
        BillingAddress : &estimate.CreateSubItemEstimateBillingAddressParams{
            Line1 : "PO Box 9999",
            City : "Walnut",
            Zip : "91789",
            Country : "US",
        },
        Customer : &estimate.CreateSubItemEstimateCustomerParams{
            Taxability : enum.TaxabilityTaxable,
        },
    }).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.EstimateCreateSubItemEstimateRequest{
    SubscriptionItems : []*chargebee.EstimateCreateSubItemEstimateSubscriptionItem{
        {
            ItemPriceId : "basic-USD",
            BillingCycles : chargebee.Int32(2),
            Quantity : chargebee.Int32(1),
        },
        {
            ItemPriceId : "day-pass-USD",
            UnitPrice : chargebee.Int64(100),
        },
    },
    BillingAddress : &chargebee.EstimateCreateSubItemEstimateBillingAddress{
        Line1 : "PO Box 9999",
        City : "Walnut",
        Zip : "91789",
        Country : "US",
    },
    Customer : &chargebee.EstimateCreateSubItemEstimateCustomer{
        Taxability : chargebee.TaxabilityTaxable,
    },
}
  res, err := client.Estimate.CreateSubItemEstimate(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.createSubItemEstimate()
            .billingAddressLine1("PO Box 9999")
            .billingAddressCity("Walnut")
            .billingAddressZip("91789")
            .billingAddressCountry("US")
            .subscriptionItemItemPriceId(0, "basic-USD")
            .subscriptionItemBillingCycles(0, 2)
            .subscriptionItemQuantity(0, 1)
            .subscriptionItemItemPriceId(1, "day-pass-USD")
            .subscriptionItemUnitPrice(1, 100L)
            .customerTaxability(Taxability.TAXABLE)
            .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.CreateSubscriptionItemEstimateParams;
import com.chargebee.v4.models.estimate.responses.CreateSubscriptionItemEstimateResponse;
import java.util.List;

public class CreateSubscriptionItemEstimate {

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

        CreateSubscriptionItemEstimateParams.BillingAddressParams billingAddressParams =
            CreateSubscriptionItemEstimateParams.BillingAddressParams.builder()
                .line1("PO Box 9999")
                .city("Walnut")
                .zip("91789")
                .country("US")
                .build();

        CreateSubscriptionItemEstimateParams.CustomerParams customerParams =
            CreateSubscriptionItemEstimateParams.CustomerParams.builder()
                .taxability(CreateSubscriptionItemEstimateParams.CustomerParams.Taxability.TAXABLE)
                .build();

        CreateSubscriptionItemEstimateParams.SubscriptionItemsParams subscriptionItem0 =
            CreateSubscriptionItemEstimateParams.SubscriptionItemsParams.builder()
                .itemPriceId("basic-USD")
                .billingCycles(2)
                .quantity(1)
                .build();

        CreateSubscriptionItemEstimateParams.SubscriptionItemsParams subscriptionItem1 =
            CreateSubscriptionItemEstimateParams.SubscriptionItemsParams.builder()
                .itemPriceId("day-pass-USD")
                .unitPrice(100L)
                .build();

        List<CreateSubscriptionItemEstimateParams.SubscriptionItemsParams> subscriptionItemsList =
            List.of(subscriptionItem0, subscriptionItem1);

        CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder()
            .billingAddress(billingAddressParams)
            .subscriptionItems(subscriptionItemsList)
            .customer(customerParams)
            .build();

        CreateSubscriptionItemEstimateResponse response = client.estimates().createSubscriptionItemEstimate(params);

        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.createSubItemEstimate({
        subscription_items: [
            {
                item_price_id: "basic-USD",
                billing_cycles: 2,
                quantity: 1
            },
            {
                item_price_id: "day-pass-USD",
                unit_price: 100
            }
        ],
        billing_address: {
            line1: "PO Box 9999",
            city: "Walnut",
            zip: 91789,
            country: "US"
        },
        customer: {
            taxability: "taxable"
        }
    });

    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()->createSubItemEstimate([
    "subscription_items" => [
        [
            "item_price_id" => "basic-USD",
            "billing_cycles" => 2,
            "quantity" => 1
        ],
        [
            "item_price_id" => "day-pass-USD",
            "unit_price" => 100
        ]
    ],
    "billing_address" => [
        "line1" => "PO Box 9999",
        "city" => "Walnut",
        "zip" => "91789",
        "country" => "US"
    ],
    "customer" => [
        "taxability" => "taxable"
    ]
]);
$estimate = $result->estimate;
```

#### Python

```python
import chargebee
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Estimate.create_sub_item_estimate(
    cb_client.Estimate.CreateSubItemEstimateParams(
        subscription_items=[
            cb_client.Estimate.CreateSubItemEstimateSubscriptionItemParams(
              item_price_id="basic-USD",
              billing_cycles=2,
              quantity=1
            ),
            cb_client.Estimate.CreateSubItemEstimateSubscriptionItemParams(
              item_price_id="day-pass-USD",
              unit_price=100
            )
        ],
        billing_address=cb_client.Estimate.CreateSubItemEstimateBillingAddressParams(
            line1="PO Box 9999",
            city="Walnut",
            zip="91789",
            country="US"
        ),
        customer=cb_client.Estimate.CreateSubItemEstimateCustomerParams(
            taxability=chargebee.Taxability.TAXABLE
        )
    )
)
estimate = response.estimate
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Estimate.create_sub_item_estimate({
  :billing_address => {
    :line1 => "PO Box 9999",
    :city => "Walnut",
    :zip => "91789",
    :country => "US"
  },
  :subscription_items => [
    {
      :item_price_id => "basic-USD",
      :billing_cycles => 2,
      :quantity => 1
    },
    {
      :item_price_id => "day-pass-USD",
      :unit_price => 100
    }
  ],
  :customer => {
    :taxability => "TAXABLE"
  }
})

estimate = result.estimate
```

### Create subscription with tier price override

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/estimates/create_subscription_for_items \
     -u {site_api_key}:\
     -d "billing_address[line1]"="PO Box 9999" \
     -d "billing_address[city]"="Walnut" \
     -d "billing_address[zip]"="91789" \
     -d "billing_address[country]"="US" \
     -d "subscription_items[item_price_id][0]"="basic-USD-yearly" \
     -d "subscription_items[billing_cycles][0]"=2 \
     -d "subscription_items[quantity][0]"=1 \
     -d "item_tiers[item_price_id][0]"="basic-USD-yearly" \
     -d "item_tiers[starting_unit][0]"=1 \
     -d "item_tiers[ending_unit][0]"=10 \
     -d "item_tiers[price][0]"=1000 \
     -d "item_tiers[item_price_id][1]"="basic-USD-yearly" \
     -d "item_tiers[starting_unit][1]"=11 \
     -d "item_tiers[ending_unit][1]"=20 \
     -d "item_tiers[price][1]"=2500 \
     -d "item_tiers[item_price_id][2]"="basic-USD-yearly" \
     -d "item_tiers[starting_unit][2]"=21 \
     -d "item_tiers[price][2]"=4000 \
     -d "customer[taxability]"="EXEMPT"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Estimate.CreateSubItemEstimate()
		.BillingAddressLine1("PO Box 9999")
		.BillingAddressCity("Walnut")
		.BillingAddressZip("91789")
		.BillingAddressCountry("US")
		.SubscriptionItemItemPriceId(0, "basic-USD-yearly")
		.SubscriptionItemBillingCycles(0, 2)
		.SubscriptionItemQuantity(0, 1)
		.ItemTierItemPriceId(0, "basic-USD-yearly")
		.ItemTierStartingUnit(0, 1)
		.ItemTierEndingUnit(0, 10)
		.ItemTierPrice(0, 1000)
		.ItemTierItemPriceId(1, "basic-USD-yearly")
		.ItemTierStartingUnit(1, 11)
		.ItemTierEndingUnit(1, 20)
		.ItemTierPrice(1, 2500)
		.ItemTierItemPriceId(2, "basic-USD-yearly")
		.ItemTierStartingUnit(2, 21)
		.ItemTierPrice(2, 4000)
		.CustomerTaxability(TaxabilityEnum.Exempt)
		.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"
    "github.com/chargebee/chargebee-go/v3/models/estimate"
    enum "github.com/chargebee/chargebee-go/v3/enum"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := estimateAction.CreateSubItemEstimate(&estimate.CreateSubItemEstimateRequestParams{
        SubscriptionItems : []*estimate.CreateSubItemEstimateSubscriptionItemParams{
            {
                ItemPriceId : "basic-USD-yearly",
                BillingCycles : chargebee.Int32(2),
                Quantity : chargebee.Int32(1),
            },
        },
        ItemTiers : []*estimate.CreateSubItemEstimateItemTierParams{
            {
                ItemPriceId : "basic-USD-yearly",
                StartingUnit : chargebee.Int32(1),
                EndingUnit : chargebee.Int32(10),
                Price : chargebee.Int64(1000),
            },
            {
                ItemPriceId : "basic-USD-yearly",
                StartingUnit : chargebee.Int32(11),
                EndingUnit : chargebee.Int32(20),
                Price : chargebee.Int64(2500),
            },
            {
                ItemPriceId : "basic-USD-yearly",
                StartingUnit : chargebee.Int32(21),
                Price : chargebee.Int64(4000),
            },
        },
        BillingAddress : &estimate.CreateSubItemEstimateBillingAddressParams{
            Line1 : "PO Box 9999",
            City : "Walnut",
            Zip : "91789",
            Country : "US",
        },
        Customer : &estimate.CreateSubItemEstimateCustomerParams{
            Taxability : enum.TaxabilityExempt,
        },
    }).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.EstimateCreateSubItemEstimateRequest{
    SubscriptionItems : []*chargebee.EstimateCreateSubItemEstimateSubscriptionItem{
        {
            ItemPriceId : "basic-USD-yearly",
            BillingCycles : chargebee.Int32(2),
            Quantity : chargebee.Int32(1),
        },
    },
    ItemTiers : []*chargebee.EstimateCreateSubItemEstimateItemTier{
        {
            ItemPriceId : "basic-USD-yearly",
            StartingUnit : chargebee.Int32(1),
            EndingUnit : chargebee.Int32(10),
            Price : chargebee.Int64(1000),
        },
        {
            ItemPriceId : "basic-USD-yearly",
            StartingUnit : chargebee.Int32(11),
            EndingUnit : chargebee.Int32(20),
            Price : chargebee.Int64(2500),
        },
        {
            ItemPriceId : "basic-USD-yearly",
            StartingUnit : chargebee.Int32(21),
            Price : chargebee.Int64(4000),
        },
    },
    BillingAddress : &chargebee.EstimateCreateSubItemEstimateBillingAddress{
        Line1 : "PO Box 9999",
        City : "Walnut",
        Zip : "91789",
        Country : "US",
    },
    Customer : &chargebee.EstimateCreateSubItemEstimateCustomer{
        Taxability : chargebee.TaxabilityExempt,
    },
}
  res, err := client.Estimate.CreateSubItemEstimate(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.createSubItemEstimate()
            .billingAddressLine1("PO Box 9999")
            .billingAddressCity("Walnut")
            .billingAddressZip("91789")
            .billingAddressCountry("US")
            .subscriptionItemItemPriceId(0, "basic-USD-yearly")
            .subscriptionItemBillingCycles(0, 2)
            .subscriptionItemQuantity(0, 1)
            .itemTierItemPriceId(0, "basic-USD-yearly")
            .itemTierStartingUnit(0, 1)
            .itemTierEndingUnit(0, 10)
            .itemTierPrice(0, 1000L)
            .itemTierItemPriceId(1, "basic-USD-yearly")
            .itemTierStartingUnit(1, 11)
            .itemTierEndingUnit(1, 20)
            .itemTierPrice(1, 2500L)
            .itemTierItemPriceId(2, "basic-USD-yearly")
            .itemTierStartingUnit(2, 21)
            .itemTierPrice(2, 4000L)
            .customerTaxability(Taxability.EXEMPT)
            .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.CreateSubscriptionItemEstimateParams;
import com.chargebee.v4.models.estimate.responses.CreateSubscriptionItemEstimateResponse;
import java.util.List;

public class CreateSubscriptionItemEstimate {

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

        CreateSubscriptionItemEstimateParams.BillingAddressParams billingAddressParams =
            CreateSubscriptionItemEstimateParams.BillingAddressParams.builder()
                .line1("PO Box 9999")
                .city("Walnut")
                .zip("91789")
                .country("US")
                .build();

        CreateSubscriptionItemEstimateParams.CustomerParams customerParams =
            CreateSubscriptionItemEstimateParams.CustomerParams.builder()
                .taxability(CreateSubscriptionItemEstimateParams.CustomerParams.Taxability.EXEMPT)
                .build();

        CreateSubscriptionItemEstimateParams.SubscriptionItemsParams subscriptionItem0 =
            CreateSubscriptionItemEstimateParams.SubscriptionItemsParams.builder()
                .itemPriceId("basic-USD-yearly")
                .billingCycles(2)
                .quantity(1)
                .build();

        List<CreateSubscriptionItemEstimateParams.SubscriptionItemsParams> subscriptionItemsList =
            List.of(subscriptionItem0);

        CreateSubscriptionItemEstimateParams.ItemTiersParams itemTier0 =
            CreateSubscriptionItemEstimateParams.ItemTiersParams.builder()
                .itemPriceId("basic-USD-yearly")
                .startingUnit(1)
                .endingUnit(10)
                .price(1000L)
                .build();

        CreateSubscriptionItemEstimateParams.ItemTiersParams itemTier1 =
            CreateSubscriptionItemEstimateParams.ItemTiersParams.builder()
                .itemPriceId("basic-USD-yearly")
                .startingUnit(11)
                .endingUnit(20)
                .price(2500L)
                .build();

        CreateSubscriptionItemEstimateParams.ItemTiersParams itemTier2 =
            CreateSubscriptionItemEstimateParams.ItemTiersParams.builder()
                .itemPriceId("basic-USD-yearly")
                .startingUnit(21)
                .price(4000L)
                .build();

        List<CreateSubscriptionItemEstimateParams.ItemTiersParams> itemTiersList =
            List.of(itemTier0, itemTier1, itemTier2);

        CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder()
            .billingAddress(billingAddressParams)
            .subscriptionItems(subscriptionItemsList)
            .itemTiers(itemTiersList)
            .customer(customerParams)
            .build();

        CreateSubscriptionItemEstimateResponse response = client.estimates().createSubscriptionItemEstimate(params);

        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.createSubItemEstimate({
        subscription_items: [
            {
                item_price_id: "basic-USD-yearly",
                billing_cycles: 2,
                quantity: 1
            }
        ],
        item_tiers: [
            {
                item_price_id: "basic-USD-yearly",
                starting_unit: 1,
                ending_unit: 10,
                price: 1000
            },
            {
                item_price_id: "basic-USD-yearly",
                starting_unit: 11,
                ending_unit: 20,
                price: 2500
            },
            {
                item_price_id: "basic-USD-yearly",
                starting_unit: 21,
                price: 4000
            }
        ],
        billing_address: {
            line1: "PO Box 9999",
            city: "Walnut",
            zip: 91789,
            country: "US"
        },
        customer: {
            taxability: "exempt"
        }
    });

    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()->createSubItemEstimate([
    "subscription_items" => [
        [
            "item_price_id" => "basic-USD-yearly",
            "billing_cycles" => 2,
            "quantity" => 1
        ]
    ],
    "item_tiers" => [
        [
            "item_price_id" => "basic-USD-yearly",
            "starting_unit" => 1,
            "ending_unit" => 10,
            "price" => 1000
        ],
        [
            "item_price_id" => "basic-USD-yearly",
            "starting_unit" => 11,
            "ending_unit" => 20,
            "price" => 2500
        ],
        [
            "item_price_id" => "basic-USD-yearly",
            "starting_unit" => 21,
            "price" => 4000
        ]
    ],
    "billing_address" => [
        "line1" => "PO Box 9999",
        "city" => "Walnut",
        "zip" => "91789",
        "country" => "US"
    ],
    "customer" => [
        "taxability" => "exempt"
    ]
]);
$estimate = $result->estimate;
```

#### Python

```python
import chargebee
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Estimate.create_sub_item_estimate(
    cb_client.Estimate.CreateSubItemEstimateParams(
        subscription_items=[
            cb_client.Estimate.CreateSubItemEstimateSubscriptionItemParams(
              item_price_id="basic-USD-yearly",
              billing_cycles=2,
              quantity=1
            )
        ],
        item_tiers=[
            cb_client.Estimate.CreateSubItemEstimateItemTierParams(
              item_price_id="basic-USD-yearly",
              starting_unit=1,
              ending_unit=10,
              price=1000
            ),
            cb_client.Estimate.CreateSubItemEstimateItemTierParams(
              item_price_id="basic-USD-yearly",
              starting_unit=11,
              ending_unit=20,
              price=2500
            ),
            cb_client.Estimate.CreateSubItemEstimateItemTierParams(
              item_price_id="basic-USD-yearly",
              starting_unit=21,
              price=4000
            )
        ],
        billing_address=cb_client.Estimate.CreateSubItemEstimateBillingAddressParams(
            line1="PO Box 9999",
            city="Walnut",
            zip="91789",
            country="US"
        ),
        customer=cb_client.Estimate.CreateSubItemEstimateCustomerParams(
            taxability=chargebee.Taxability.EXEMPT
        )
    )
)
estimate = response.estimate
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Estimate.create_sub_item_estimate({
  :billing_address => {
    :line1 => "PO Box 9999",
    :city => "Walnut",
    :zip => "91789",
    :country => "US"
  },
  :subscription_items => [
    {
      :item_price_id => "basic-USD-yearly",
      :billing_cycles => 2,
      :quantity => 1
    }
  ],
  :item_tiers => [
    {
      :item_price_id => "basic-USD-yearly",
      :starting_unit => 1,
      :ending_unit => 10,
      :price => 1000
    },
    {
      :item_price_id => "basic-USD-yearly",
      :starting_unit => 11,
      :ending_unit => 20,
      :price => 2500
    },
    {
      :item_price_id => "basic-USD-yearly",
      :starting_unit => 21,
      :price => 4000
    }
  ],
  :customer => {
    :taxability => "EXEMPT"
  }
})

estimate = result.estimate
```

### Create subscription with trial

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/estimates/create_subscription_for_items \
     -u {site_api_key}:\
     -d "billing_address[line1]"="PO Box 9999" \
     -d "billing_address[city]"="Walnut" \
     -d "billing_address[zip]"="91789" \
     -d "billing_address[country]"="US" \
     -d "subscription_items[item_price_id][0]"="basic-USD-weekly"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Estimate.CreateSubItemEstimate()
		.BillingAddressLine1("PO Box 9999")
		.BillingAddressCity("Walnut")
		.BillingAddressZip("91789")
		.BillingAddressCountry("US")
		.SubscriptionItemItemPriceId(0, "basic-USD-weekly")
		.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"
    "github.com/chargebee/chargebee-go/v3/models/estimate"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := estimateAction.CreateSubItemEstimate(&estimate.CreateSubItemEstimateRequestParams{
        SubscriptionItems : []*estimate.CreateSubItemEstimateSubscriptionItemParams{
            {
                ItemPriceId : "basic-USD-weekly",
            },
        },
        BillingAddress : &estimate.CreateSubItemEstimateBillingAddressParams{
            Line1 : "PO Box 9999",
            City : "Walnut",
            Zip : "91789",
            Country : "US",
        },
    }).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.EstimateCreateSubItemEstimateRequest{
    SubscriptionItems : []*chargebee.EstimateCreateSubItemEstimateSubscriptionItem{
        {
            ItemPriceId : "basic-USD-weekly",
        },
    },
    BillingAddress : &chargebee.EstimateCreateSubItemEstimateBillingAddress{
        Line1 : "PO Box 9999",
        City : "Walnut",
        Zip : "91789",
        Country : "US",
    },
}
  res, err := client.Estimate.CreateSubItemEstimate(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.createSubItemEstimate()
            .billingAddressLine1("PO Box 9999")
            .billingAddressCity("Walnut")
            .billingAddressZip("91789")
            .billingAddressCountry("US")
            .subscriptionItemItemPriceId(0, "basic-USD-weekly")
            .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.CreateSubscriptionItemEstimateParams;
import com.chargebee.v4.models.estimate.responses.CreateSubscriptionItemEstimateResponse;
import java.util.List;

public class CreateSubscriptionItemEstimate {

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

        CreateSubscriptionItemEstimateParams.BillingAddressParams billingAddressParams =
            CreateSubscriptionItemEstimateParams.BillingAddressParams.builder()
                .line1("PO Box 9999")
                .city("Walnut")
                .zip("91789")
                .country("US")
                .build();

        CreateSubscriptionItemEstimateParams.SubscriptionItemsParams subscriptionItem0 =
            CreateSubscriptionItemEstimateParams.SubscriptionItemsParams.builder()
                .itemPriceId("basic-USD-weekly")
                .build();

        List<CreateSubscriptionItemEstimateParams.SubscriptionItemsParams> subscriptionItemsList =
            List.of(subscriptionItem0);

        CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder()
            .billingAddress(billingAddressParams)
            .subscriptionItems(subscriptionItemsList)
            .build();

        CreateSubscriptionItemEstimateResponse response = client.estimates().createSubscriptionItemEstimate(params);

        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.createSubItemEstimate({
        subscription_items: [
            {
                item_price_id: "basic-USD-weekly"
            }
        ],
        billing_address: {
            line1: "PO Box 9999",
            city: "Walnut",
            zip: 91789,
            country: "US"
        }
    });

    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()->createSubItemEstimate([
    "subscription_items" => [
        [
            "item_price_id" => "basic-USD-weekly"
        ]
    ],
    "billing_address" => [
        "line1" => "PO Box 9999",
        "city" => "Walnut",
        "zip" => "91789",
        "country" => "US"
    ]
]);
$estimate = $result->estimate;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Estimate.create_sub_item_estimate(
    cb_client.Estimate.CreateSubItemEstimateParams(
        subscription_items=[
            cb_client.Estimate.CreateSubItemEstimateSubscriptionItemParams(
              item_price_id="basic-USD-weekly"
            )
        ],
        billing_address=cb_client.Estimate.CreateSubItemEstimateBillingAddressParams(
            line1="PO Box 9999",
            city="Walnut",
            zip="91789",
            country="US"
        )
    )
)
estimate = response.estimate
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Estimate.create_sub_item_estimate({
  :billing_address => {
    :line1 => "PO Box 9999",
    :city => "Walnut",
    :zip => "91789",
    :country => "US"
  },
  :subscription_items => [
    {
      :item_price_id => "basic-USD-weekly"
    }
  ]
})

estimate = result.estimate
```

### Create subscription with unbilled charges

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/estimates/create_subscription_for_items \
     -u {site_api_key}:\
     -d "billing_address[line1]"="PO Box 9999" \
     -d "billing_address[city]"="Walnut" \
     -d "billing_address[zip]"="91789" \
     -d "billing_address[country]"="US" \
     -d "subscription_items[item_price_id][0]"="basic-USD" \
     -d "subscription_items[billing_cycles][0]"=2 \
     -d "subscription_items[quantity][0]"=1 \
     -d "subscription_items[item_price_id][1]"="day-pass-USD" \
     -d "subscription_items[unit_price][1]"=100 \
     -d invoice_immediately="false"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Estimate.CreateSubItemEstimate()
		.BillingAddressLine1("PO Box 9999")
		.BillingAddressCity("Walnut")
		.BillingAddressZip("91789")
		.BillingAddressCountry("US")
		.SubscriptionItemItemPriceId(0, "basic-USD")
		.SubscriptionItemBillingCycles(0, 2)
		.SubscriptionItemQuantity(0, 1)
		.SubscriptionItemItemPriceId(1, "day-pass-USD")
		.SubscriptionItemUnitPrice(1, 100)
		.InvoiceImmediately(false)
		.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"
    "github.com/chargebee/chargebee-go/v3/models/estimate"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := estimateAction.CreateSubItemEstimate(&estimate.CreateSubItemEstimateRequestParams{
        SubscriptionItems : []*estimate.CreateSubItemEstimateSubscriptionItemParams{
            {
                ItemPriceId : "basic-USD",
                BillingCycles : chargebee.Int32(2),
                Quantity : chargebee.Int32(1),
            },
            {
                ItemPriceId : "day-pass-USD",
                UnitPrice : chargebee.Int64(100),
            },
        },
        BillingAddress : &estimate.CreateSubItemEstimateBillingAddressParams{
            Line1 : "PO Box 9999",
            City : "Walnut",
            Zip : "91789",
            Country : "US",
        },
        InvoiceImmediately : chargebee.Bool(false),
    }).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.EstimateCreateSubItemEstimateRequest{
    SubscriptionItems : []*chargebee.EstimateCreateSubItemEstimateSubscriptionItem{
        {
            ItemPriceId : "basic-USD",
            BillingCycles : chargebee.Int32(2),
            Quantity : chargebee.Int32(1),
        },
        {
            ItemPriceId : "day-pass-USD",
            UnitPrice : chargebee.Int64(100),
        },
    },
    BillingAddress : &chargebee.EstimateCreateSubItemEstimateBillingAddress{
        Line1 : "PO Box 9999",
        City : "Walnut",
        Zip : "91789",
        Country : "US",
    },
    InvoiceImmediately : chargebee.Bool(false),
}
  res, err := client.Estimate.CreateSubItemEstimate(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.createSubItemEstimate()
            .billingAddressLine1("PO Box 9999")
            .billingAddressCity("Walnut")
            .billingAddressZip("91789")
            .billingAddressCountry("US")
            .subscriptionItemItemPriceId(0, "basic-USD")
            .subscriptionItemBillingCycles(0, 2)
            .subscriptionItemQuantity(0, 1)
            .subscriptionItemItemPriceId(1, "day-pass-USD")
            .subscriptionItemUnitPrice(1, 100L)
            .invoiceImmediately(false)
            .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.CreateSubscriptionItemEstimateParams;
import com.chargebee.v4.models.estimate.responses.CreateSubscriptionItemEstimateResponse;
import java.util.List;

public class CreateSubscriptionItemEstimate {

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

        CreateSubscriptionItemEstimateParams.BillingAddressParams billingAddressParams =
            CreateSubscriptionItemEstimateParams.BillingAddressParams.builder()
                .line1("PO Box 9999")
                .city("Walnut")
                .zip("91789")
                .country("US")
                .build();

        CreateSubscriptionItemEstimateParams.SubscriptionItemsParams subscriptionItem0 =
            CreateSubscriptionItemEstimateParams.SubscriptionItemsParams.builder()
                .itemPriceId("basic-USD")
                .billingCycles(2)
                .quantity(1)
                .build();

        CreateSubscriptionItemEstimateParams.SubscriptionItemsParams subscriptionItem1 =
            CreateSubscriptionItemEstimateParams.SubscriptionItemsParams.builder()
                .itemPriceId("day-pass-USD")
                .unitPrice(100L)
                .build();

        List<CreateSubscriptionItemEstimateParams.SubscriptionItemsParams> subscriptionItemsList =
            List.of(subscriptionItem0, subscriptionItem1);

        CreateSubscriptionItemEstimateParams params = CreateSubscriptionItemEstimateParams.builder()
            .billingAddress(billingAddressParams)
            .subscriptionItems(subscriptionItemsList)
            .invoiceImmediately(false)
            .build();

        CreateSubscriptionItemEstimateResponse response = client.estimates().createSubscriptionItemEstimate(params);

        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.createSubItemEstimate({
        subscription_items: [
            {
                item_price_id: "basic-USD",
                billing_cycles: 2,
                quantity: 1
            },
            {
                item_price_id: "day-pass-USD",
                unit_price: 100
            }
        ],
        billing_address: {
            line1: "PO Box 9999",
            city: "Walnut",
            zip: 91789,
            country: "US"
        },
        invoice_immediately: false
    });

    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()->createSubItemEstimate([
    "subscription_items" => [
        [
            "item_price_id" => "basic-USD",
            "billing_cycles" => 2,
            "quantity" => 1
        ],
        [
            "item_price_id" => "day-pass-USD",
            "unit_price" => 100
        ]
    ],
    "billing_address" => [
        "line1" => "PO Box 9999",
        "city" => "Walnut",
        "zip" => "91789",
        "country" => "US"
    ],
    "invoice_immediately" => false
]);
$estimate = $result->estimate;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.Estimate.create_sub_item_estimate(
    cb_client.Estimate.CreateSubItemEstimateParams(
        subscription_items=[
            cb_client.Estimate.CreateSubItemEstimateSubscriptionItemParams(
              item_price_id="basic-USD",
              billing_cycles=2,
              quantity=1
            ),
            cb_client.Estimate.CreateSubItemEstimateSubscriptionItemParams(
              item_price_id="day-pass-USD",
              unit_price=100
            )
        ],
        billing_address=cb_client.Estimate.CreateSubItemEstimateBillingAddressParams(
            line1="PO Box 9999",
            city="Walnut",
            zip="91789",
            country="US"
        ),
        invoice_immediately=False
    )
)
estimate = response.estimate
```

#### Ruby

```ruby
require 'chargebee'

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

result = ChargeBee::Estimate.create_sub_item_estimate({
  :billing_address => {
    :line1 => "PO Box 9999",
    :city => "Walnut",
    :zip => "91789",
    :country => "US"
  },
  :subscription_items => [
    {
      :item_price_id => "basic-USD",
      :billing_cycles => 2,
      :quantity => 1
    },
    {
      :item_price_id => "day-pass-USD",
      :unit_price => 100
    }
  ],
  :invoice_immediately => "false"
})

estimate = result.estimate
```

## Sample Response

```json
{
  "estimate": {
    "created_at": 1612964957,
    "invoice_estimate": {
      "amount_due": 1100,
      "amount_paid": 0,
      "credits_applied": 0,
      "currency_code": "USD",
      "customer_id": "__test__8asyKSOceaKFNz",
      "date": 1612964957,
      "line_item_discounts": {},
      "line_item_taxes": [
        {
          "is_non_compliance_tax": false,
          "is_partial_tax_applied": false,
          "line_item_id": "li___test__8asyKSOceaN3O1",
          "object": "line_item_tax",
          "tax_amount": 91,
          "tax_name": "Tax",
          "tax_rate": 10,
          "taxable_amount": 909
        },
        {..}
      ],
      "line_items": [
        {
          "amount": 1000,
          "customer_id": "__test__8asyKSOceaKFNz",
          "date_from": 1612964957,
          "date_to": 1615384157,
          "description": "basic USD",
          "discount_amount": 0,
          "entity_id": "basic-USD",
          "entity_type": "plan_item_price",
          "id": "li___test__8asyKSOceaN3O1",
          "is_taxed": true,
          "item_level_discount_amount": 0,
          "object": "line_item",
          "pricing_model": "per_unit",
          "quantity": 1,
          "tax_amount": 91,
          "tax_rate": 10,
          "unit_amount": 1000
        },
        {..}
      ],
      "object": "invoice_estimate",
      "price_type": "tax_inclusive",
      "recurring": true,
      "round_off_amount": 0,
      "sub_total": 1100,
      "taxes": [
        {
          "amount": 100,
          "description": "Tax @ 10%",
          "name": "Tax",
          "object": "tax"
        },
        {..}
      ],
      "total": 1100
    },
    "object": "estimate",
    "subscription_estimate": {
      "currency_code": "USD",
      "next_billing_at": 1615384157,
      "object": "subscription_estimate",
      "status": "active"
    }
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/estimates/create_subscription_for_items

## Input Parameters

- `billing_cycles` (optional, integer, min=0)
  The number of billing cycles the subscription runs before canceling. If not provided, then the billing cycles [set for the plan-item price](/docs/api/item_prices/item_price-object#billing_cycles) is used.

- `mandatory_items_to_remove` (optional, string, max chars=100)
  Item ids of [mandatorily attached addons](/docs/api/attached_items) that are to be removed from the subscription.

- `terms_to_charge` (optional, integer, min=1)
  The number of subscription billing cycles (including the first one) to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html) .

- `billing_alignment_mode` (optional, enumerated string)
  Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) for Calendar Billing. Only applicable when using Calendar Billing. The default value is that which has been configured for the site.
  Possible enum values:
    - `immediate`
      Subscription period will be aligned with the configured billing date immediately, with credits or charges raised accordingly..
    - `delayed`
      Subscription period will be aligned with the configured billing date at the next renewal.

- `coupon_ids` (optional, string, max chars=100)
  List of coupons to be applied to this subscription. You can provide coupon ids or coupon codes.

- `invoice_immediately` (optional, boolean)
  If there are charges raised immediately for the subscription, this parameter specifies whether those charges are to be invoiced immediately or added to [unbilled charges](https://www.chargebee.com/docs/unbilled-charges.html). The default value is as per the [site settings](https://www.chargebee.com/docs/unbilled-charges.html#configuration) .
  
  **Note:** `invoice_immediately` only affects charges that are raised at the time of execution of this API call. Any charges scheduled to be raised in the future are not affected by this parameter.
  
  .

- `invoice_date` (optional, timestamp(UTC) in seconds)
  The document date displayed on the invoice PDF. By default, it is the date of creation of the invoice or, when Metered Billing is enabled, it can be the date of closing the invoice. Provide this value to backdate the invoice (set the invoice date to a value in the past). Backdating an invoice is done for reasons such as booking revenue for a previous date or when the non-recurring charge is effective as of a past date. `taxes` and `line_item_taxes` are computed based on the tax configuration as of this date. The date should not be more than one calendar month into the past. For example, if today is 13th January, then you cannot pass a value that is earlier than 13th December.

- `client_profile_id` (optional, string, max chars=50)
  Indicates the Client profile id for the customer. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration.

- `subscription` (optional, string)
  Parameters for subscription
  - `id` (optional, string, max chars=50)
    A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
  - `trial_end` (optional, timestamp(UTC) in seconds)
    End of the trial period for the subscription. This overrides the trial period set for the plan-item. The value must be later than `start_date`. Set it to `0` to have no trial period.
  - `start_date` (optional, timestamp(UTC) in seconds)
    The date/time at which the subscription is to start. If not provided, the subscription starts immediately. You can provide a value in the past as well. This is called backdating the subscription creation and is done when the subscription has already been provisioned but its billing has been delayed. Backdating is allowed only when the following prerequisites are met:
    
    -   Backdating is enabled for subscription creation operations.
    -   The current day of the month does not exceed the limit set in Chargebee for backdating such operations. This day is typically the day of the month by which the accounting for the previous month must be closed.
    -   The date is not more than duration X into the past, where X is the billing period of the plan. For example, if the period of the plan in the subscription is 2 months and today is 14th April, `start_date` cannot be earlier than 14th February.
  - `offline_payment_method` (optional, enumerated string)
    The preferred offline payment method for the subscription.
    Possible enum values:
      - `no_preference`
        No Preference
      - `cash`
        Cash
      - `check`
        Check
      - `bank_transfer`
        Bank Transfer
      - `ach_credit`
        ACH Credit
      - `sepa_credit`
        SEPA Credit
      - `boleto`
        Boleto
      - `us_automated_bank_transfer`
        US Automated Bank Transfer
      - `eu_automated_bank_transfer`
        EU Automated Bank Transfer
      - `uk_automated_bank_transfer`
        UK Automated Bank Transfer
      - `jp_automated_bank_transfer`
        JP Automated Bank Transfer
      - `mx_automated_bank_transfer`
        MX Automated Bank Transfer
      - `custom`
        Custom
  - `free_period` (optional, integer, min=1)
    The period of time by which the first term of the subscription is to be extended free-of-charge. The value must be in multiples of free\_period\_unit.
  - `free_period_unit` (optional, enumerated string)
    The unit of time in multiples of which the free\_period parameter is expressed. The value must be equal to or lower than the [period\_unit](/docs/api/v2/pcv-1/plans/create-a-plan#period_unit) attribute of the [plan](/docs/api/v2/pcv-1/subscriptions/create-a-subscription#plan_id) chosen.
    Possible enum values:
      - `day`
        Charge based on day(s)
      - `week`
        Charge based on week(s)
      - `month`
        Charge based on month(s)
      - `year`
        Charge based on year(s)
  - `contract_term_billing_cycle_on_renewal` (optional, integer, min=1, max=100)
    Number of billing cycles the new contract term should run for, on contract renewal. The default value is the same as `billing_cycles` or a custom value depending on the [site configuration](https://www.chargebee.com/docs/contract-terms.html#configuring-contract-terms) .
  - `trial_end_action` (optional, enumerated string)
    Applicable only when [End-of-trial Action](https://www.chargebee.com/docs/1.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) has been enabled for the site. Whenever the subscription has a trial period, this attribute (parameter) is returned (required) and specifies the operation to be carried out for the subscription once the trial ends.
    Possible enum values:
      - `site_default`
        This is the default value. The action [configured for the site](https://www.chargebee.com/docs/1.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect.
      - `plan_default`
        The action [configured for the site](https://www.chargebee.com/docs/1.0/trial_periods_hidden.html#how-to-define-the-end-of-trial-actions-for-subscriptions) at the time when the trial ends, takes effect.
      - `activate_subscription`
        The subscription activates and charges are raised for non-metered items.
      - `cancel_subscription`
        The subscription cancels.

- `billing_address` (optional, string)
  Parameters for billing\_address
  - `line1` (optional, string, max chars=150)
    Address line 1
  - `line2` (optional, string, max chars=150)
    Address line 2
  - `line3` (optional, string, max chars=150)
    Address line 3
  - `city` (optional, string, max chars=50)
    The name of the city.
  - `state_code` (optional, string, max chars=50)
    The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code) without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set `state_code` as `AZ` (not `US-AZ` ). For Tamil Nadu (India), set as `TN` (not `IN-TN` ). For British Columbia (Canada), set as `BC` (not `CA-BC` ).
  - `zip` (optional, string, max chars=20)
    Zip or postal code. The number of characters is validated according to the rules [specified here](https://chromium-i18n.appspot.com/ssl-address) .
  - `country` (optional, string, max chars=50)
    The billing address country of the customer. Must be one of [ISO 3166 alpha-2 country code](https://www.iso.org/iso-3166-country-codes.html) .
    
    **Note**: If you enter an invalid country code, the system will return an error.
    
    **Brexit**
    
    If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or later, or have [manually enable](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, then `XI` (the code for **United Kingdom - Northern Ireland**) is available as an option.
  - `validation_status` (optional, enumerated string, default=not_validated)
    The address verification status.
    Possible enum values:
      - `not_validated`
        Address is not yet validated.
      - `valid`
        Address was validated successfully.
      - `partially_valid`
        The address is valid for taxability but has not been validated for shipping.
      - `invalid`
        Address is invalid.

- `shipping_address` (optional, string)
  Parameters for shipping\_address
  - `line1` (optional, string, max chars=150)
    Address line 1
  - `line2` (optional, string, max chars=150)
    Address line 2
  - `line3` (optional, string, max chars=150)
    Address line 3
  - `city` (optional, string, max chars=50)
    The name of the city.
  - `state_code` (optional, string, max chars=50)
    The [ISO 3166-2 state/province code](https://www.iso.org/obp/ui/#search/code) without the country prefix. Currently supported for USA, Canada and India. For instance, for Arizona (USA), set `state_code` as `AZ` (not `US-AZ` ). For Tamil Nadu (India), set as `TN` (not `IN-TN` ). For British Columbia (Canada), set as `BC` (not `CA-BC` ).
  - `zip` (optional, string, max chars=20)
    Zip or postal code. The number of characters is validated according to the rules [specified here](https://chromium-i18n.appspot.com/ssl-address) .
  - `country` (optional, string, max chars=50)
    The billing address country of the customer. Must be one of [ISO 3166 alpha-2 country code](https://www.iso.org/iso-3166-country-codes.html) .
    
    **Note**: If you enter an invalid country code, the system will return an error.
    
    **Brexit**
    
    If you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or later, or have [manually enable](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, then `XI` (the code for **United Kingdom - Northern Ireland**) is available as an option.
  - `validation_status` (optional, enumerated string, default=not_validated)
    The address verification status.
    Possible enum values:
      - `not_validated`
        Address is not yet validated.
      - `valid`
        Address was validated successfully.
      - `partially_valid`
        The address is valid for taxability but has not been validated for shipping.
      - `invalid`
        Address is invalid.

- `customer` (optional, string)
  Parameters for customer
  - `vat_number` (optional, string, max chars=20)
    VAT number of this customer. If not provided then taxes are not calculated for the estimate. Applicable only when taxes are configured for the EU or UK region. VAT validation is not done for this.
  - `vat_number_prefix` (optional, string, max chars=10)
    An overridden value for the first two characters of the [full VAT number](https://en.wikipedia.org/wiki/VAT_identification_number). Only applicable specifically for customers with `[billing_address](/docs/api/customers/customer-object#billing_address)`
    
    `country` as `XI` (which is **United Kingdom - Northern Ireland** ).
    
    When you have enabled [EU VAT](https://www.chargebee.com/docs/eu-vat.html) in 2021 or have [manually enabled](https://www.chargebee.com/docs/brexit.html#what-needs-to-be-done-in-chargebee) the Brexit configuration, you have the option of setting `[billing_address](/docs/api/customers/customer-object#billing_address)`
    
    `country` as `XI`. That's the code for **United Kingdom - Northern Ireland**. The first two characters of the VAT number in such a case is `XI` by default. However, if the VAT number was registered in UK, the value should be `GB`. Set `vat_number_prefix` to `GB` for such cases.
  - `registered_for_gst` (optional, boolean)
    Confirms that a customer is registered under GST. If set to `true` then the [Reverse Charge Mechanism](https://www.chargebee.com/docs/australian-gst.html#reverse-charge-mechanism) is applicable. This field is applicable only when Australian GST is configured for your site.
  - `taxability` (optional, enumerated string, default=taxable)
    Specifies if the customer is liable for tax
    Possible enum values:
      - `taxable`
        Computes tax for the customer based on the [site configuration](https://www.chargebee.com/docs/tax.html). In some cases, depending on the region, shipping\_address is needed. If not provided, then billing\_address is used to compute tax. If that's not available either, the tax is taken as zero.
      - `exempt`
        -   Customer is exempted from tax. When using Chargebee's native [Taxes](https://www.chargebee.com/docs/tax.html) feature or when using the [TaxJar integration](https://www.chargebee.com/docs/taxjar.html), no other action is needed.
        -   However, when using our [Avalara integration](https://www.chargebee.com/docs/avalara.html), optionally, specify `entity_code` or `exempt_number` attributes if you use Chargebee's [AvaTax for Sales](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption) or specify `exemption_details` attribute if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. Tax may still be applied by Avalara for certain values of `entity_code`/`exempt_number`/`exemption_details` based on the state/region/province of the taxable address.
  - `entity_code` (optional, enumerated string)
    The exemption category of the customer, for USA and Canada. Applicable if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption) .
    Possible enum values:
      - `a`
        Federal government
      - `b`
        State government
      - `c`
        Tribe/Status Indian/Indian Band
      - `d`
        Foreign diplomat
      - `e`
        Charitable or benevolent organization
      - `f`
        Religious organization
      - `g`
        Resale
      - `h`
        Commercial agricultural production
      - `i`
        Industrial production/manufacturer
      - `j`
        Direct pay permit
      - `k`
        Direct mail
      - `l`
        Other or custom
      - `m`
        Educational organization
      - `n`
        Local government
      - `p`
        Commercial aquaculture
      - `q`
        Commercial Fishery
      - `r`
        Non-resident
      - `med1`
        US Medical Device Excise Tax with exempt sales tax
      - `med2`
        US Medical Device Excise Tax with taxable sales tax
  - `exempt_number` (optional, string, max chars=100)
    Any string value that will cause the sale to be exempted. Use this if your finance team manually verifies and tracks exemption certificates. Applicable if you use Chargebee's [AvaTax for Sales integration](https://www.chargebee.com/docs/avalara.html#configuring-tax-exemption) .
  - `exemption_details` (optional)
    Indicates the exemption information. You can customize customer exemption based on specific Location, Tax level (Federal, State, County and Local), Category of Tax or specific Tax Name. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration. To know more about what values you need to provide, refer to this [Avalara's API document](https://developer.avalara.com/communications/dev-guide_rest_v2/customizing-transactions/sample-transactions/exemption/) .
  - `customer_type` (optional, enumerated string)
    Indicates the type of the customer. This is applicable only if you use [Chargebee's AvaTax for Communications](https://www.chargebee.com/docs/avatax-for-communication.html) integration.
    Possible enum values:
      - `residential`
        When the purchase is made by a customer for home use
      - `business`
        When the purchase is made at a place of business
      - `senior_citizen`
        When the purchase is made by a customer who meets the jurisdiction requirements to be considered a senior citizen and qualifies for senior citizen tax breaks
      - `industrial`
        When the purchase is made by an industrial business

- `contract_term` (optional, enumerated string)
  Parameters for contract\_term
  - `action_at_term_end` (optional, enumerated string)
    Action to be taken when the contract term completes.
    Possible enum values:
      - `renew`
        -   Contract term completes and a new contract term is started for the number of billing cycles specified in [`contract_billing_cycle_on_renewal`](/docs/api/v2/pcv-1/subscriptions/create-subscription-for-customer#contract_term_billing_cycle_on_renewal).
        -   The `action_at_term_end` for the new contract term is set to `renew`.
      - `evergreen`
        Contract term completes and the subscription renews.
      - `cancel`
        Contract term completes and subscription is canceled.
  - `cancellation_cutoff_period` (optional, integer, default=0)
    The number of days before [`contract_end`](/docs/api/contract_terms/contract_term-object#contract_end) , during which the customer is barred from canceling the contract term. The customer is allowed to cancel the contract term via the Self-Serve Portal only before this period. This allows you to have sufficient time for processing the contract term closure.

- `subscription_items` (optional, array)
  Parameters for subscription\_items
  - `item_price_id` (required, string, max chars=100)
    The unique identifier of the item price.
  - `quantity` (optional, integer)
    The quantity of the item purchased
  - `quantity_in_decimal` (optional, string, max chars=33)
    The decimal representation of the quantity of the item purchased. Can be provided for quantity-based item prices and only when [multi-decimal pricing](/docs/api/getting-started) is enabled.
  - `unit_price` (optional, in cents)
    The price/per unit price of the item. When not provided, [the value set](/docs/api/item_prices/item-price-object) for the item price is used. This is only applicable when the `pricing_model` of the item price is `flat_fee` or `per_unit`. Also, it is only allowed when [price overriding](https://www.chargebee.com/docs/price-override.html) is enabled for the site. The value depends on the type of currency. If `changes_scheduled_at` is in the past and a `unit_price` is not passed, then the item price's current unit price is considered even if the item price did not exist on the date as of when the change is scheduled.
  - `unit_price_in_decimal` (optional, string, max chars=39)
    When [price overriding](https://www.chargebee.com/docs/2.0/price-override.html) is enabled for the site, the price or per-unit price of the item can be set here. The [value set for the item price](/docs/api/item_prices/item_price-object#price) is used by default. Provide the value as a decimal string in major units of the currency. Can be provided only when [multi-decimal pricing](/docs/api/getting-started) is enabled.
  - `billing_cycles` (optional, integer)
    For the plan-item price: the value determines the number of billing cycles the subscription runs before canceling automatically. If not provided, then [the value set](/docs/api/item_prices/item-price-object) for the plan-item price is used.
    
    For addon-item prices: If [addon billing cycles](https://www.chargebee.com/docs/2.0/addons-billingcycle.html) are enabled then this is the number of subscription billing cycles for which the addon is included. If not provided, then [the value set under attached addons](/docs/api/attached_items/attached-item-object) is used. Further, if that value is not provided, then [the value set for the addon-item price](/docs/api/item_prices/item-price-object) is used.
  - `trial_end` (optional, timestamp(UTC) in seconds)
    The date/time when the trial period of the item ends. Applies to plan-items and--when [enabled](https://www.chargebee.com/docs/2.0/addons-trial.html) --addon-items as well.
  - `service_period_days` (optional, integer)
    The service period of the item in days from the day of charge.
  - `charge_on_event` (optional, enumerated string)
    When `charge_on_option` option is set to `on_event` , this parameter specifies the event at which the charge-item is applied to the subscription. This parameter only applies to charge-items.
    Possible enum values:
      - `subscription_creation`
        the time of creation of the subscription.
      - `subscription_trial_start`
        the time when the trial period of the subscription begins.
      - `plan_activation`
        same as subscription activation, but also includes the case when the plan-item of the subscription is changed.
      - `subscription_activation`
        the moment a subscription enters an `active` or `non-renewing` state. Also includes reactivations of canceled subscriptions.
      - `contract_termination`
        when a contract term is [terminated](/docs/api/subscriptions/cancel-subscription-for-items#contract_term_cancel_option) .
  - `charge_once` (optional, boolean)
    Indicates if the charge-item is to be charged only once or each time the `charge_on_event` occurs. This parameter only applies to charge-items.
  - `description` (optional, string, max chars=500)
    **Limited availability**
    
    Subscription-level item descriptions are available only on sites where this feature is enabled. Please reach out to the Chargebee [support](https://www.chargebee.com/docs/billing/2.0/kb/getting-started/how-to-contact-chargebees-support-team?utm_source=docs_api&utm_medium=content&utm_campaign=support) to enable this feature.
    
    A description for this item that applies only to this subscription. When set, it is used on the customer-facing invoice instead of the description configured for the item price, and is returned as `entity_description` on the invoice [line item](/docs/api/invoices/invoice-object#invoice_line_items). When not set, the description configured for the item price is used.
    
    **Constraints**
    
    -   Maximum 500 characters.
    -   Whether a description is shown on the invoice at all continues to be controlled by the item price's [show\_description\_in\_invoices](/docs/api/item_prices#show_description_in_invoices) setting. This parameter determines which description is shown, not whether one is shown.
  - `charge_on_option` (optional, enumerated string)
    Indicates when the charge-item is to be charged. This parameter only applies to charge-items.
    Possible enum values:
      - `immediately`
        The item is charged immediately on being added to the subscription.
      - `on_event`
        The item is charged at the occurrence of the event specified as `charge_on_event` .

- `discounts` (optional, array)
  Parameters for discounts
  - `apply_on` (optional, enumerated string)
    The amount on the invoice to which the discount is applied.
    Possible enum values:
      - `invoice_amount`
        The discount is applied to the invoice `sub_total` .
      - `specific_item_price`
        The discount is applied to the `invoice.line_item.amount` that corresponds to the item price specified by `item_price_id` .
  - `duration_type` (required, enumerated string)
    Specifies the time duration for which this discount is attached to the subscription.
    Possible enum values:
      - `one_time`
        The discount stays attached to the subscription till it is applied on an invoice **once**. It is removed after that from the subscription.
      - `forever`
        The discount is attached to the subscription and applied on the invoices till it is [explicitly removed](/docs/api/subscriptions/update-subscription-for-items#discounts_operation_type) .
      - `limited_period`
        The discount is attached to the subscription and applied on the invoices for a limited duration. This duration starts from the point it is applied to an invoice for the first time and expires after a period specified by `period` and `period_unit` .
  - `percentage` (optional, double)
    The percentage of the original amount that should be deducted from it.
  - `amount` (optional, in cents)
    The value of the discount. [The format of this value](/docs/api/currencies) depends on the kind of currency.
  - `period` (optional, integer)
    The duration of time for which the discount is attached to the subscription, in `period_units`. Applicable only when `duration_type` is `limited_period`.
  - `period_unit` (optional, enumerated string)
    The unit of time for `period`. Applicable only when `duration_type` is `limited_period`.
    Possible enum values:
      - `day`
        A period of 24 hours.
      - `week`
        A period of 7 days.
      - `month`
        A period of 1 calendar month.
      - `year`
        A period of 1 calendar year.
  - `included_in_mrr` (optional, boolean)
    The discount is included in MRR calculations for your site. This attribute is only applicable when `duration_type` is `one_time` and when the [feature is enabled](https://www.chargebee.com/docs/reporting.html#dashboards_flexible-mrr-calculation) in Chargebee. Also, If the [site-level setting](https://www.chargebee.com/docs/reporting.html#chart_flexible-mrr-calculation) is to exclude one-time discounts from MRR calculations, this value is always returned `false`.
  - `item_price_id` (optional, string, max chars=100)
    The [id of the item price](/docs/api/subscriptions/subscription-object#subscription_items_item_price_id) in the subscription to which the discount is to be applied. Relevant only when `apply_on` = `specific_item_price`.
  - `quantity` (optional, integer)
    Specifies the number of free units provided for the item, without affecting the total quantity sold

- `item_tiers` (optional, array)
  Parameters for item\_tiers
  - `item_price_id` (optional, string, max chars=100)
    The id of the item price for which the tier price is being overridden.
  - `starting_unit` (optional, integer)
    The lowest value in the quantity tier.
  - `ending_unit` (optional, integer)
    The highest value in the quantity tier.
  - `price` (optional, in cents)
    The overridden price of the tier. The value depends on the [type of currency](/docs/api/estimates) .
  - `starting_unit_in_decimal` (optional, string, max chars=33)
    The decimal representation of the lowest value of quantity in this tier. This is zero for the lowest tier. For all other tiers, it is the same as `ending_unit_in_decimal` of the next lower tier. Returned only when the pricing\_model is `tiered` , `volume` or `stairstep` and [multi-decimal pricing](/docs/api/getting-started) is enabled.
  - `ending_unit_in_decimal` (optional, string, max chars=33)
    The decimal representation of the highest value of quantity in this tier. This attribute is not applicable for the highest tier. For all other tiers, it must be equal to the `starting_unit_in_decimal` of the next higher tier. Returned only when the pricing\_model is `tiered` , `volume` or `stairstep` and [multi-decimal pricing](/docs/api/getting-started) is enabled.
  - `price_in_decimal` (optional, string, max chars=39)
    The decimal representation of the per-unit price for the tier when the `pricing_model` is `tiered` or `volume`. When the `pricing_model` is `stairstep` , it is the decimal representation of the total price for the item. The value is in major units of the currency. Returned when the plan is quantity-based and [multi-decimal pricing](/docs/api/getting-started) is enabled.
  - `pricing_type` (optional, enumerated string)
    Pricing type for the tier.
    Possible enum values:
      - `per_unit`
        Indicates that the tier pricing is based on individual units. Customers are charged a fixed price per unit. For example, if the price per unit is $2 and the customer consumes 150 units, they will be charged $300 (150 × $2).
      - `flat_fee`
        Indicates that the tier pricing is a flat fee, applied to the entire tier regardless of the number of units consumed. For the **stairstep** pricing model, `pricing_type` will be set to `flat_fee` by default. For example, if the flat fee for a tier is $100, the customer pays $100 whether they consume 1 unit or the maximum number of units within that tier.
      - `package`
        Indicates that the tier pricing is based on a package of units. Customers are charged for each block or package of units. For example, if the package size is 100 units and the cost per block is $20 consuming 400 units will result in a charge of $80 (4 × $20).
  - `package_size` (optional, integer)
    Package size for the tier when pricing type is `package`. Specify the number of units that make up one package. For example, if 1000 API hits are grouped into a single package, set the package size to 1000.

- `tax_providers_fields` (optional, array)
  Parameters for tax\_providers\_fields
  - `provider_name` (optional, string, max chars=50)
    Name of the tax provider.
  - `field_id` (optional, string, max chars=50)
    Field id of the attribute which tax vendor has provided while getting onboarded with Chargebee.
  - `field_value` (optional, string, max chars=50)
    The value of the related tax field

## Returns

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