# Update subscription estimate

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


Generates an estimate for the 'update subscription' operation. The input will be similar to the [Update Subscription](/docs/api/v2/pcv-1/subscriptions/update-a-subscription) API but subscription will not be updated, only an estimate will be created.

In the response,

-   `[subscription_estimate](/docs/api/estimates/estimate-object)`: The details of the changed subscription such as `status`, next billing date, and so on.
-   `[invoice_estimate](/docs/api/estimates/estimate-object)`:The details of the immediate invoice, if it is generated. An immediate invoice is not generated when:
    -   `end_of_term` parameter is true
    -   `prorate` parameter is `false`
    -   No changes are made to `subscription` or `addons`.
    -   For changes such as [quantity downgrades](https://www.chargebee.com/docs/proration.html#proration-mechanism_plan-quantity-downgrade-paid-invoice).
-   `[next_invoice_estimate](/docs/api/estimates/estimate-object)`:The details of the invoice to be generated later (if any) on the occasion that no immediate invoice has been generated.
-   `[credit_note_estimates](/docs/api/estimates/estimate-object)`:The list of credit notes (if any) generated during this operation.
-   `[unbilled_charge_estimates](/docs/api/estimates/estimate-object)`: The details of charges that have not been invoiced. This is returned only if the `invoice_immediately` parameter is set to `false`.

**Note:** If you have configured [EU VAT](https://www.chargebee.com/docs/eu-vat.html) or [Customized taxes](https://www.chargebee.com/docs/customized-tax.html), you need to specify the applicable parameters for calculating taxes - _billing\_address\[\]_, _shipping\_address\[\]_, _customer\[vat\_number\]_, _customer\[taxability\]_ etc. Otherwise tax calculation will be ignored.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/estimates/update_subscription \
     -u {site_api_key}:\
     -d "subscription[id]"="__test__KyVnHhSBWl3M42aj" \
     -d "subscription[plan_id]"="plan1" \
     -d "billing_address[line1]"="PO Box 9999" \
     -d "billing_address[city]"="Walnut" \
     -d "billing_address[zip]"="91789" \
     -d "billing_address[country]"="US"
```

#### .NET

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

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = Estimate.UpdateSubscription()
		.SubscriptionId("__test__KyVnHhSBWl3M42aj")
		.SubscriptionPlanId("plan1")
		.BillingAddressLine1("PO Box 9999")
		.BillingAddressCity("Walnut")
		.BillingAddressZip("91789")
		.BillingAddressCountry("US")
		.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.UpdateSubscription(&estimate.UpdateSubscriptionRequestParams{
        Subscription : &estimate.UpdateSubscriptionSubscriptionParams{
            Id : "__test__KyVnHhSBWl3M42aj",
            PlanId : "plan1",
        },
        BillingAddress : &estimate.UpdateSubscriptionBillingAddressParams{
            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.EstimateUpdateSubscriptionRequest{
    Subscription : &chargebee.EstimateUpdateSubscriptionSubscription{
        Id : "__test__KyVnHhSBWl3M42aj",
        PlanId : "plan1",
    },
    BillingAddress : &chargebee.EstimateUpdateSubscriptionBillingAddress{
        Line1 : "PO Box 9999",
        City : "Walnut",
        Zip : "91789",
        Country : "US",
    },
}
  res, err := client.Estimate.UpdateSubscription(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.updateSubscription()
            .subscriptionId("__test__KyVnHhSBWl3M42aj")
            .subscriptionPlanId("plan1")
            .billingAddressLine1("PO Box 9999")
            .billingAddressCity("Walnut")
            .billingAddressZip("91789")
            .billingAddressCountry("US")
            .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.EstimateUpdateSubscriptionParams;
import com.chargebee.v4.models.estimate.responses.EstimateUpdateSubscriptionResponse;

public class EstimateUpdateSubscription {

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

        EstimateUpdateSubscriptionParams.SubscriptionParams subscriptionParams =
            EstimateUpdateSubscriptionParams.SubscriptionParams.builder()
                .id("__test__KyVnHhSBWl3M42aj")
                .planId("plan1")
                .build();

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

        EstimateUpdateSubscriptionParams params = EstimateUpdateSubscriptionParams.builder()
            .subscription(subscriptionParams)
            .billingAddress(billingAddressParams)
            .build();

        EstimateUpdateSubscriptionResponse response = client.estimates().updateSubscription(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.updateSubscription({
        subscription: {
            id: "__test__KyVnHhSBWl3M42aj",
            plan_id: "plan1"
        },
        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()->updateSubscription([
    "subscription" => [
        "id" => "__test__KyVnHhSBWl3M42aj",
        "plan_id" => "plan1"
    ],
    "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.update_subscription(
    cb_client.Estimate.UpdateSubscriptionParams(
        subscription=cb_client.Estimate.UpdateSubscriptionSubscriptionParams(
            id="__test__KyVnHhSBWl3M42aj",
            plan_id="plan1"
        ),
        billing_address=cb_client.Estimate.UpdateSubscriptionBillingAddressParams(
            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.update_subscription({
  :subscription => {
    :id => "__test__KyVnHhSBWl3M42aj",
    :plan_id => "plan1"
  },
  :billing_address => {
    :line1 => "PO Box 9999",
    :city => "Walnut",
    :zip => "91789",
    :country => "US"
  }
})

estimate = result.estimate
```

## Sample Response

```json
{
  "estimate": {
    "created_at": 1517505714,
    "credit_note_estimates": [
      {
        "amount_allocated": 895,
        "amount_available": 0,
        "currency_code": "USD",
        "customer_id": "__test__KyVnHhSBWl3M42aj",
        "line_item_discounts": {},
        "line_item_taxes": {},
        "line_items": [
          {
            "amount": 895,
            "customer_id": "__test__KyVnHhSBWl3M42aj",
            "date_from": 1517505714,
            "date_to": 1519924914,
            "description": "No Trial - Prorated Credits for 01-Feb-2018 - 01-Mar-2018",
            "discount_amount": 0,
            "entity_id": "no_trial",
            "entity_type": "plan",
            "id": "li___test__KyVnHhSBWl3TH2at",
            "is_taxed": false,
            "item_level_discount_amount": 0,
            "object": "line_item",
            "pricing_model": "per_unit",
            "quantity": 1,
            "subscription_id": "__test__KyVnHhSBWl3M42aj",
            "tax_amount": 0,
            "unit_amount": 895
          },
          {..}
        ],
        "object": "credit_note_estimate",
        "price_type": "tax_exclusive",
        "reference_invoice_id": "__demo_inv__6",
        "round_off_amount": 0,
        "sub_total": 895,
        "taxes": {},
        "total": 895,
        "type": "adjustment"
      },
      {..}
    ],
    "invoice_estimate": {
      "amount_due": 1500,
      "amount_paid": 0,
      "credits_applied": 0,
      "currency_code": "USD",
      "customer_id": "__test__KyVnHhSBWl3M42aj",
      "date": 1517505714,
      "line_item_discounts": {},
      "line_item_taxes": {},
      "line_items": [
        {
          "amount": 1500,
          "customer_id": "__test__KyVnHhSBWl3M42aj",
          "date_from": 1517505714,
          "date_to": 1519924914,
          "description": "Plan1 - Prorated Charges",
          "discount_amount": 0,
          "entity_id": "plan1",
          "entity_type": "plan",
          "id": "li___test__KyVnHhSBWl3T72ar",
          "is_taxed": false,
          "item_level_discount_amount": 0,
          "object": "line_item",
          "pricing_model": "per_unit",
          "quantity": 1,
          "subscription_id": "__test__KyVnHhSBWl3M42aj",
          "tax_amount": 0,
          "unit_amount": 1500
        },
        {..}
      ],
      "object": "invoice_estimate",
      "price_type": "tax_exclusive",
      "recurring": true,
      "round_off_amount": 0,
      "sub_total": 1500,
      "taxes": {},
      "total": 1500
    },
    "object": "estimate",
    "subscription_estimate": {
      "currency_code": "USD",
      "id": "__test__KyVnHhSBWl3M42aj",
      "next_billing_at": 1519924914,
      "object": "subscription_estimate",
      "status": "active"
    }
  }
}
```

## URL Format

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

## Input Parameters

- `changes_scheduled_at` (optional, timestamp(UTC) in seconds)
  When `change_option` is set to `specific_date` , then set the date/time at which the subscription change is to happen or has happened. **Note:** It is recommended not to pass this parameter along with `reactivate_from`. `changes_scheduled_at` can be set to a value in the past. This is called backdating the subscription change and is performed when the subscription change has already been provisioned but its billing has been delayed. Backdating is allowed only when the following prerequisites are met:
  
  -   Backdating must be enabled for subscription change operations.
      
  -   Only the following changes can be backdated:
      
  -   Changes in the recurring items or their prices.
      
  -   Addition of non-recurring items.
      
  -   Subscription `status` is `active`, `cancelled`, or `non_renewing`.
      
  -   The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is typically the day of the month by which the accounting for the previous month must be closed.
      
  -   The date is on or after `current_term_start`.
      
  -   The date is on or after the last date/time any of the following changes were made:
      
  -   Changes in the recurring items or their prices.
      
  -   Addition of non-recurring items.
      
  -   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, `changes_scheduled_at` cannot be earlier than 14th February. .

- `change_option` (optional, enumerated string)
  When the quote is converted, this attribute determines the date/time as of when the subscription change is to be carried out.
  Possible enum values:
    - `immediately`
      The change is carried out immediately.
    - `end_of_term`
      The change is carried out at the end of the current billing cycle of the subscription.
    - `specific_date`
      The change is carried out as of the date specified under `changes_scheduled_at` .

- `replace_addon_list` (optional, boolean, default=false)
  Should be true if the existing addons should be replaced with the ones that are being passed.

- `mandatory_addons_to_remove` (optional, string, max chars=100)
  List of addons IDs that are mandatory to the plan and has to be removed from the subscription.

- `invoice_date` (optional, timestamp(UTC) in seconds)
  The document date displayed on the invoice PDF. The default value is the current date. Provide this value to backdate the invoice. Backdating an invoice is done for reasons such as booking revenue for a previous date or when the subscription is effective as of a past date. Moreover, if `create_pending_invoices` is set to `true` , and if the site is configured to set invoice dates to date of closing, then upon invoice closure, this date is changed to the invoice closing date. taxes and line\_item\_taxes are computed based on the tax configuration as of `invoice_date`. When passing this parameter, the following prerequisites must be met:
  
  -   `invoice_date` must be in the past.
  -   `invoice_date` is not 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.
  -   It is not earlier than `changes_scheduled_at`, `reactivate_from`, or `trial_end`.
  -   `invoice_immediately` is `true`. .

- `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 is used.

- `terms_to_charge` (optional, integer, min=1)
  The number of subscription billing cycles to [invoice in advance](https://www.chargebee.com/docs/advance-invoices.html). If a new term is started for the subscription due to this API call, then `terms_to_charge` is inclusive of this new term. See description for the `force_term_reset` parameter to learn more about when a subscription term is reset.

- `reactivate_from` (optional, timestamp(UTC) in seconds)
  If the subscription `status` is `cancelled` and it is being reactivated via this operation, this is the date/time at which the subscription should be reactivated. **Note:** It is recommended not to pass this parameter along with `changed_scheduled_at`. `reactivate_from` can be backdated (set to a value in the past). Use backdating when the subscription has been reactivated already but its billing has been delayed. Backdating is allowed only when the following prerequisites are met:
  
  -   Backdating must be enabled for subscription reactivation operations.
  -   The current day of the month does not exceed the limit set in Chargebee for backdating subscription change. This limit is the day of the month by which the accounting for the previous month must be closed.
  -   The date is on or after the last date/time any of the product catalog items of the subscription were changed.
  -   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, `changes_scheduled_at` cannot be earlier than 14th February. .

- `billing_alignment_mode` (optional, enumerated string)
  Override the [billing alignment mode](https://www.chargebee.com/docs/calendar-billing.html#alignment-of-billing-date) chosen for the site for calendar billing. Only applicable when using calendar billing.
  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](/docs/api/coupon_codes) .

- `replace_coupon_list` (optional, boolean, default=false)
  If `true` then the existing `coupon_ids` list for the subscription is replaced by the one provided. If `false` then the provided list gets added to the existing `coupon_ids` .

- `prorate` (optional, boolean)
  -   When `true`: [Prorated credits or charges](https://www.chargebee.com/docs/1.0/proration.html#proration-mechanism) are created as applicable for this change.
  -   When `false`: The subscription is changed without creating any credits or charges.
  -   When not provided, the value configured in the [site settings](https://www.chargebee.com/docs/1.0/proration.html#proration-for-subscription-change) is considered.
  
  **Caveat**
  
  For further changes within the same billing term, when `prorate` is set to `true`, **credits** are **not created** when **all** the conditions below hold true:
  
  An immediate previous change was made
  
  -   with `prorate` set to `false` and
  -   no changes were made to the subscription's billing term and
  -   a change was made to either the subscription's plan, its addons, or the prices of the plan or addons.

- `end_of_term` (optional, boolean, default=false)
  Set this to true if you want the update to be applied at the end of the current subscription billing cycle.

- `force_term_reset` (optional, boolean, default=false)
  Say the subscription has the renewal date as 28th of every month. When the plan-item price of the subscription is set to one that has the same billing period as the current plan-item price, the subscription change does not change the term. In other words, the subscription still renews on the 28th. Passing this parameter as `true` will have the subscription reset its term to the current date (provided `end_of_term` is false). **Note**: When the new plan-item price has a billing period different from the current plan-item price of the subscription, the term is always reset, regardless of the value passed for this parameter.

- `reactivate` (optional, boolean)
  Applicable only for `cancelled` subscriptions. When passed as `true` , the canceled subscription is activated; otherwise subscription changes are made without changing its `status`. If not passed, subscription will be activated only if `subscription_items` is passed.

- `include_delayed_charges` (optional, boolean, default=false)
  If true, all the unbilled charges will be included for the invoice estimate.

- `use_existing_balances` (optional, boolean, default=true)
  The generated invoice\_estimate/next\_invoice\_estimate will include all the balances - Promotional Credits, Refundable Credits, and Excess Payments - if any. If you don't want these balances to be included you can specify 'false' for the parameter _use\_existing\_balances_ .

- `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.
  
  .

- `subscription` (optional, string)
  Parameters for subscription
  - `id` (required, string, max chars=50)
    A unique and immutable identifier for the subscription. If not provided, it is autogenerated.
  - `plan_id` (optional, string, max chars=100)
    Identifier of the plan for this subscription
  - `plan_quantity` (optional, integer, default=1, min=1)
    Represents the plan quantity for this subscription.
  - `plan_unit_price` (optional, in cents, min=0)
    Amount that will override the Plan's default price. The unit depends on the [type of currency](/docs/api/getting-started) .
  - `setup_fee` (optional, in cents, min=0)
    Amount that will override the default setup fee. The unit depends on the [type of currency](/docs/api/getting-started) .
  - `plan_quantity_in_decimal` (optional, string, max chars=33)
    The decimal representation of the quantity of the plan purchased. Can be provided for quantity-based plans and only when [multi-decimal pricing](/docs/api/v2/pcv-1/currencies) is enabled.
  - `plan_unit_price_in_decimal` (optional, string, max chars=39)
    When price overriding is enabled for the site, the price or per-unit price of the plan can be set here. The value [set for the plan](/docs/api/v2/pcv-1/plans/plan-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/v2/pcv-1/currencies) is enabled.
  - `start_date` (optional, timestamp(UTC) in seconds)
    The new start date of a `future` subscription. Applicable only for `future` subscriptions.
  - `trial_end` (optional, timestamp(UTC) in seconds)
    The time at which the trial has ended or will end for the subscription. This is only allowed when the subscription `status` is `future` , `in_trial` , or `cancelled`. Also, the value must not be earlier than `changes_scheduled_at` or `start_date`. **Note**: This parameter can be backdated (set to a value in the past) only when the subscription is in `cancelled` or `in_trial` `status`. Do this to keep a record of when the trial ended in case it ended at some point in the past. When `trial_end` is backdated, the subscription immediately goes into `active` or `non_renewing` status.
  - `auto_collection` (optional, enumerated string)
    Defines whether payments need to be collected automatically for this subscription. Overrides customer's auto-collection property.
    Possible enum values:
      - `on`
        Whenever an invoice is created for this subscription, an automatic charge will be attempted on the payment method available.
      - `off`
        Automatic collection of charges will not be made for this subscription. Use this for offline payments.
  - `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)
  - `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`
        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. This is the default value when `trial_end_action` is **not** defined for the plan.
      - `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. This is the default value when `trial_end_action` is defined for the plan.
      - `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.

- `addons` (optional, array)
  Parameters for addons
  - `id` (optional, string, max chars=100)
    Identifier of the addon. Multiple addons can be passed.
  - `quantity` (optional, integer)
    Quantity of the addon. Applicable for addons with `pricing_model` other than `flat_fee` .
  - `unit_price` (optional, in cents)
    The price or per-unit-price of the addon. The value depends on the [type of currency](/docs/api/getting-started).
    
    **Note:**
    
    For recurring addons, this is the final price or per-unit price for each billing period of the subscription, regardless of the [addon period](/docs/api/v2/pcv-1/addons/addon-object#period). For example, consider the following details:
    
    -   The `unit_price` provided is $10
    -   The addon billing period is 1 month.
    -   The plan billing period is 3 months.
    -   The addon is only billed for $10 on each subscription renewal.
  - `billing_cycles` (optional, integer)
    Number of billing cycles the addon will be charged for. When not set, the addon is attached to the subscription for an indefinite number of billing cycles. While updating a subscription to a plan with a different billing period, set this parameter again or its value will be lost. And so, the addon will be attached indefinitely.
  - `quantity_in_decimal` (optional, string, max chars=33)
    The decimal representation of the quantity of the addon. Can be provided for quantity-based addons and only when [multi-decimal pricing](/docs/api/v2/pcv-1/currencies) is enabled.
  - `unit_price_in_decimal` (optional, string, max chars=39)
    When [price overriding](http://chargebee.com/docs/price-override.html ) is enabled for the site, the price or per-unit price of the addon can be set here. The value [set for the addon](/docs/api/v2/pcv-1/addons/addon-object#price) is used by default. However, the price provided here is considered as the price of the addon for an entire billing cycle of the subscription regardless of the value of the addon `period`. Provide the value as a decimal string in major units of the currency. Can be provided only when [multi-decimal pricing](/docs/api/v2/pcv-1/currencies) is enabled.
  - `trial_end` (optional, timestamp(UTC) in seconds)
    The time at which the trial ends for the addon. To update this value, redo the complete addon set using [`replace_addon_list`](/docs/api/v2/pcv-1/subscriptions/update-a-subscription#replace_addon_list). (Addon trial periods must be enabled by [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) .)
  - `proration_type` (optional, enumerated string)
    Specifies how to manage charges or credits for the addon for this estimate. It's relevant only for addons that have their `[pricing_model](/docs/api/v2/pcv-1/addons/addon-object#pricing_model)` set to `per_unit`. You may use this parameter only if the change to the subscription takes effect [immediately](/docs/api/v2/pcv-1/estimates/update-subscription-estimate#end_of_term).
    
    **Note** If you don't provide a value, Chargebee determines the proration logic based on the following precedence: this parameter > `[prorate](/docs/api/v2/pcv-1/subscriptions/update-a-subscription#prorate)` parameter > `[addon.proration_type](/docs/api/v2/pcv-1/addons/addon-object#proration_type)` > [site-wide proration](https://www.chargebee.com/docs/1.0/proration.html#proration-for-subscription-change) setting.
    Possible enum values:
      - `full_term`
        Charge the full price of the addon or give the full credit. Don't apply any proration.
      - `partial_term`
        Prorate the charges or credits for the rest of the current term.
      - `none`
        Don't apply any charges or credits for the addon.

- `event_based_addons` (optional, array)
  Parameters for event\_based\_addons
  - `id` (optional, string, max chars=100)
    A unique 'id' used to identify the addon.
  - `quantity` (optional, integer)
    Quantity of the addon. Applicable for addons with `pricing_model` other than `flat_fee` .
  - `unit_price` (optional, in cents)
    Amount that will override the Addon's default price. The unit depends on the [type of currency](/docs/api/getting-started) .
  - `service_period_in_days` (optional, integer)
    Defines service period of the addon in days from the day of charge.
  - `charge_on` (optional, enumerated string)
    Indicates when the non-recurring addon will be charged.
    Possible enum values:
      - `immediately`
        Charges for the addon will be applied immediately.
      - `on_event`
        Charge for the addon will be applied on the occurrence of a specified event.
  - `on_event` (optional, enumerated string)
    Event on which this addon will be charged.
    Possible enum values:
      - `subscription_creation`
        Addon will be charged on subscription creation.
      - `subscription_trial_start`
        Addon will be charged when the trial period starts.
      - `plan_activation`
        Addon will be charged on plan activation.
      - `subscription_activation`
        Addon will be charged on subscription activation.
      - `contract_termination`
        Addon will be charged on contract termination.
  - `charge_once` (optional, boolean)
    If enabled, the addon will be charged only at the first occurrence of the event. Applicable only for non-recurring add-ons.
  - `quantity_in_decimal` (optional, string, max chars=33)
    The decimal representation of the quantity of the addon. Can be provided for quantity-based addons and only when [multi-decimal pricing](/docs/api/v2/pcv-1/currencies) is enabled.
  - `unit_price_in_decimal` (optional, string, max chars=39)
    When [price overriding](http://chargebee.com/docs/price-override.html ) is enabled for the site, the price or per-unit price of the addon can be set here. The value [set for the addon](/docs/api/v2/pcv-1/addons/addon-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/v2/pcv-1/currencies) is enabled.

## Returns

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